Account for '_
in suggestions
This commit is contained in:
parent
2100b31535
commit
ba3b44c508
2 changed files with 5 additions and 2 deletions
|
@ -1521,6 +1521,9 @@ crate fn add_missing_lifetime_specifiers_label(
|
||||||
if snippet.starts_with("&") && !snippet.starts_with("&'") {
|
if snippet.starts_with("&") && !snippet.starts_with("&'") {
|
||||||
introduce_suggestion
|
introduce_suggestion
|
||||||
.push((param.span, format!("&'a {}", &snippet[1..])));
|
.push((param.span, format!("&'a {}", &snippet[1..])));
|
||||||
|
} else if snippet.starts_with("&'_ ") {
|
||||||
|
introduce_suggestion
|
||||||
|
.push((param.span, format!("&'a {}", &snippet[4..])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y }
|
||||||
| ^^^^^^ ^^^^^^
|
| ^^^^^^ ^^^^^^
|
||||||
help: consider introducing a named lifetime parameter
|
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
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue