mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Convert to Place's new boxed slice projection
Fixes breaking change from rust-lang PR https://github.com/rust-lang/rust/pull/63420/
This commit is contained in:
parent
ff4a3fb52f
commit
80822b430d
1 changed files with 5 additions and 6 deletions
|
@ -252,13 +252,13 @@ fn find_stmt_assigns_to<'a, 'tcx: 'a>(
|
|||
stmts
|
||||
.rev()
|
||||
.find_map(|stmt| {
|
||||
if let mir::StatementKind::Assign(
|
||||
if let mir::StatementKind::Assign(box (
|
||||
mir::Place {
|
||||
base: mir::PlaceBase::Local(local),
|
||||
..
|
||||
},
|
||||
v,
|
||||
) = &stmt.kind
|
||||
)) = &stmt.kind
|
||||
{
|
||||
if *local == to {
|
||||
return Some(v);
|
||||
|
@ -269,10 +269,10 @@ fn find_stmt_assigns_to<'a, 'tcx: 'a>(
|
|||
})
|
||||
.and_then(|v| {
|
||||
if by_ref {
|
||||
if let mir::Rvalue::Ref(_, _, ref place) = **v {
|
||||
if let mir::Rvalue::Ref(_, _, ref place) = v {
|
||||
return base_local_and_movability(cx, mir, place);
|
||||
}
|
||||
} else if let mir::Rvalue::Use(mir::Operand::Copy(ref place)) = **v {
|
||||
} else if let mir::Rvalue::Use(mir::Operand::Copy(ref place)) = v {
|
||||
return base_local_and_movability(cx, mir, place);
|
||||
}
|
||||
None
|
||||
|
@ -291,7 +291,6 @@ fn base_local_and_movability<'tcx>(
|
|||
use rustc::mir::Place;
|
||||
use rustc::mir::PlaceBase;
|
||||
use rustc::mir::PlaceRef;
|
||||
use rustc::mir::Projection;
|
||||
|
||||
// Dereference. You cannot move things out from a borrowed value.
|
||||
let mut deref = false;
|
||||
|
@ -303,7 +302,7 @@ fn base_local_and_movability<'tcx>(
|
|||
mut projection,
|
||||
} = place.as_ref();
|
||||
if let PlaceBase::Local(local) = place_base {
|
||||
while let Some(box Projection { base, elem }) = projection {
|
||||
while let [base @ .., elem] = projection {
|
||||
projection = base;
|
||||
deref = matches!(elem, mir::ProjectionElem::Deref);
|
||||
field = !field
|
||||
|
|
Loading…
Reference in a new issue