1
Fork 0

Account for '_ in suggestions

This commit is contained in:
Esteban Küber 2020-01-27 14:35:20 -08:00
parent 2100b31535
commit ba3b44c508
2 changed files with 5 additions and 2 deletions

View file

@ -1521,6 +1521,9 @@ crate fn add_missing_lifetime_specifiers_label(
if snippet.starts_with("&") && !snippet.starts_with("&'") {
introduce_suggestion
.push((param.span, format!("&'a {}", &snippet[1..])));
} else if snippet.starts_with("&'_ ") {
introduce_suggestion
.push((param.span, format!("&'a {}", &snippet[4..])));
}
}
}

View file

@ -37,8 +37,8 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y }
| ^^^^^^ ^^^^^^
help: consider introducing a named lifetime parameter
|
LL | fn foo2<'a>(_: &'_ u8, y: &'_ u8) -> &'a u8 { y }
| ^^^^ ^^
LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y }
| ^^^^ ^^^^^^ ^^^^^^ ^^
error: aborting due to 5 previous errors