- match (lifetime_names.len(), lifetime_names.iter().next(), snippet.as_deref()) {
- (1, Some(name), Some("&")) => {
+ let lifetime_names: Vec<_> = lifetime_names.into_iter().collect();
+ match (&lifetime_names[..], snippet.as_deref()) {
+ ([name], Some("&")) => {
suggest_existing(err, &name.as_str()[..], &|name| format!("&{} ", name));
}
suggest_existing(err, &name.as_str()[..], &|name| format!("&{} ", name));
}
suggest_existing(err, &name.as_str()[..], &|n| format!("{}, ", n).repeat(count));
}
suggest_existing(err, &name.as_str()[..], &|n| format!("{}, ", n).repeat(count));
}
if snippet == "" {
// This happens when we have `type Bar<'a> = Foo<T>` where we point at the space
// before `T`. We will suggest `type Bar<'a> = Foo<'a, T>`.
if snippet == "" {
// This happens when we have `type Bar<'a> = Foo<T>` where we point at the space
// before `T`. We will suggest `type Bar<'a> = Foo<'a, T>`.
err.span_note(lifetime_spans, "these named lifetimes are available to use");
if Some("") == snippet.as_deref() {
// This happens when we have `Foo<T>` where we point at the space before `T`,
err.span_note(lifetime_spans, "these named lifetimes are available to use");
if Some("") == snippet.as_deref() {
// This happens when we have `Foo<T>` where we point at the space before `T`,