Fix span for &mut
removal suggestion
This commit is contained in:
parent
dd72b1a0df
commit
b8bd1d0826
@ -481,6 +481,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
let (pat_span, suggestion, to_remove) = if inner_pat_snippet.starts_with("mut")
|
||||
&& inner_pat_snippet["mut".len()..].starts_with(rustc_lexer::is_whitespace)
|
||||
{
|
||||
let inner_pat_snippet = inner_pat_snippet["mut".len()..].trim_start();
|
||||
let pat_span = pat_span.with_hi(
|
||||
pat_span.lo()
|
||||
+ BytePos((pat_snippet.len() - inner_pat_snippet.len()) as u32),
|
||||
|
@ -37,7 +37,7 @@ LL | &mut [_a,
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut [_a,
|
||||
LL + mut [_a,
|
||||
LL + [_a,
|
||||
|
|
||||
|
||||
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
|
||||
@ -69,7 +69,7 @@ LL | _b] => {}
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut [
|
||||
LL + mut [
|
||||
LL + [
|
||||
|
|
||||
|
||||
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
|
||||
@ -102,7 +102,7 @@ LL | &mut [_a, _b, _c] => {}
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut [_a, _b, _c] => {}
|
||||
LL + mut [_a, _b, _c] => {}
|
||||
LL + [_a, _b, _c] => {}
|
||||
|
|
||||
|
||||
error[E0508]: cannot move out of type `[Box<isize>]`, a non-copy slice
|
||||
|
@ -139,7 +139,7 @@ LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
LL + let mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
LL + let (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -155,7 +155,7 @@ LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.c
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
LL + if let mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
LL + if let (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -171,7 +171,7 @@ LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), e
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
LL + while let mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
LL + while let (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -192,12 +192,12 @@ LL | &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + (Either::One(_t), Either::Two(_u)) => (),
|
||||
|
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
LL + mut (Either::Two(_t), Either::One(_u)) => (),
|
||||
LL + (Either::Two(_t), Either::One(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -215,7 +215,7 @@ LL | &mut (Either::One(_t), Either::Two(_u))
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::One(_t), Either::Two(_u))
|
||||
LL + mut (Either::One(_t), Either::Two(_u))
|
||||
LL + (Either::One(_t), Either::Two(_u))
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -233,7 +233,7 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + (Either::One(_t), Either::Two(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -251,7 +251,7 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + (Either::One(_t), Either::Two(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -269,7 +269,7 @@ LL | &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + mut (Either::One(_t), Either::Two(_u)) => (),
|
||||
LL + (Either::One(_t), Either::Two(_u)) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
@ -301,7 +301,7 @@ LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
LL + fn f6(mut (X(_t), X(_u)): &mut (X, X)) { }
|
||||
LL + fn f6((X(_t), X(_u)): &mut (X, X)) { }
|
||||
|
|
||||
|
||||
error: aborting due to 17 previous errors
|
||||
|
@ -447,7 +447,7 @@ LL | let &mut X(_t) = sm;
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - let &mut X(_t) = sm;
|
||||
LL + let mut X(_t) = sm;
|
||||
LL + let X(_t) = sm;
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||
@ -462,7 +462,7 @@ LL | if let &mut Either::One(_t) = rm { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - if let &mut Either::One(_t) = rm { }
|
||||
LL + if let mut Either::One(_t) = rm { }
|
||||
LL + if let Either::One(_t) = rm { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||
@ -477,7 +477,7 @@ LL | while let &mut Either::One(_t) = rm { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - while let &mut Either::One(_t) = rm { }
|
||||
LL + while let mut Either::One(_t) = rm { }
|
||||
LL + while let Either::One(_t) = rm { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `Two` which is behind a mutable reference
|
||||
@ -496,12 +496,12 @@ LL | &mut Either::Two(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::Two(_t) => (),
|
||||
LL + mut Either::Two(_t) => (),
|
||||
LL + Either::Two(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||
@ -519,7 +519,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||
@ -537,7 +537,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of `rm` as enum variant `One` which is behind a mutable reference
|
||||
@ -555,7 +555,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
@ -792,7 +792,7 @@ LL | let &mut X(_t) = &mut xm;
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - let &mut X(_t) = &mut xm;
|
||||
LL + let mut X(_t) = &mut xm;
|
||||
LL + let X(_t) = &mut xm;
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -807,7 +807,7 @@ LL | if let &mut Either::One(_t) = &mut em { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - if let &mut Either::One(_t) = &mut em { }
|
||||
LL + if let mut Either::One(_t) = &mut em { }
|
||||
LL + if let Either::One(_t) = &mut em { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -822,7 +822,7 @@ LL | while let &mut Either::One(_t) = &mut em { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - while let &mut Either::One(_t) = &mut em { }
|
||||
LL + while let mut Either::One(_t) = &mut em { }
|
||||
LL + while let Either::One(_t) = &mut em { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -840,7 +840,7 @@ LL | &mut Either::One(_t)
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t)
|
||||
LL + mut Either::One(_t)
|
||||
LL + Either::One(_t)
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -858,7 +858,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -876,7 +876,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a mutable reference
|
||||
@ -894,7 +894,7 @@ LL | &mut Either::One(_t) => (),
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - &mut Either::One(_t) => (),
|
||||
LL + mut Either::One(_t) => (),
|
||||
LL + Either::One(_t) => (),
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
@ -924,7 +924,7 @@ LL | fn f2(&mut X(_t): &mut X) { }
|
||||
help: consider removing the mutable borrow
|
||||
|
|
||||
LL - fn f2(&mut X(_t): &mut X) { }
|
||||
LL + fn f2(mut X(_t): &mut X) { }
|
||||
LL + fn f2(X(_t): &mut X) { }
|
||||
|
|
||||
|
||||
error[E0507]: cannot move out of a shared reference
|
||||
|
Loading…
x
Reference in New Issue
Block a user