Strip prefix instead of replacing it with empty string
This commit is contained in:
parent
3d6705aa5a
commit
06aa7a7601
1 changed files with 2 additions and 2 deletions
|
@ -552,11 +552,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
// we may want to suggest removing a `&`.
|
||||
if sm.is_imported(expr.span) {
|
||||
if let Ok(src) = sm.span_to_snippet(sp) {
|
||||
if let Some(src) = self.replace_prefix(&src, "&", "") {
|
||||
if let Some(src) = src.strip_prefix('&') {
|
||||
return Some((
|
||||
sp,
|
||||
"consider removing the borrow",
|
||||
src,
|
||||
src.to_string(),
|
||||
Applicability::MachineApplicable,
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue