Consider all possible one letter lifetimes in suggestion
This commit is contained in:
parent
224ad326ea
commit
6dcd744df0
@ -1742,7 +1742,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
let new_lt = generics
|
||||
.as_ref()
|
||||
.and_then(|(parent_g, g)| {
|
||||
let possible = ["'a", "'b", "'c", "'d", "'e", "'f", "'g", "'h", "'i", "'j", "'k"];
|
||||
let possible: Vec<_> = (b'a'..=b'z').map(|c| format!("'{}", c as char)).collect();
|
||||
let mut lts_names = g
|
||||
.params
|
||||
.iter()
|
||||
@ -1758,9 +1758,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
);
|
||||
}
|
||||
let lts = lts_names.iter().map(|s| -> &str { &*s }).collect::<Vec<_>>();
|
||||
possible.iter().filter(|&candidate| !lts.contains(&*candidate)).next().map(|s| *s)
|
||||
possible.into_iter().find(|candidate| !lts.contains(&candidate.as_str()))
|
||||
})
|
||||
.unwrap_or("'lt");
|
||||
.unwrap_or("'lt".to_string());
|
||||
let add_lt_sugg = generics
|
||||
.as_ref()
|
||||
.and_then(|(_, g)| g.params.first())
|
||||
|
Loading…
Reference in New Issue
Block a user