Skip to content

Commit 80822b4

Browse files
committed
Convert to Place's new boxed slice projection
Fixes breaking change from rust-lang PR rust-lang/rust#63420
1 parent ff4a3fb commit 80822b4

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

clippy_lints/src/redundant_clone.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -252,13 +252,13 @@ fn find_stmt_assigns_to<'a, 'tcx: 'a>(
252252
stmts
253253
.rev()
254254
.find_map(|stmt| {
255-
if let mir::StatementKind::Assign(
255+
if let mir::StatementKind::Assign(box (
256256
mir::Place {
257257
base: mir::PlaceBase::Local(local),
258258
..
259259
},
260260
v,
261-
) = &stmt.kind
261+
)) = &stmt.kind
262262
{
263263
if *local == to {
264264
return Some(v);
@@ -269,10 +269,10 @@ fn find_stmt_assigns_to<'a, 'tcx: 'a>(
269269
})
270270
.and_then(|v| {
271271
if by_ref {
272-
if let mir::Rvalue::Ref(_, _, ref place) = **v {
272+
if let mir::Rvalue::Ref(_, _, ref place) = v {
273273
return base_local_and_movability(cx, mir, place);
274274
}
275-
} else if let mir::Rvalue::Use(mir::Operand::Copy(ref place)) = **v {
275+
} else if let mir::Rvalue::Use(mir::Operand::Copy(ref place)) = v {
276276
return base_local_and_movability(cx, mir, place);
277277
}
278278
None
@@ -291,7 +291,6 @@ fn base_local_and_movability<'tcx>(
291291
use rustc::mir::Place;
292292
use rustc::mir::PlaceBase;
293293
use rustc::mir::PlaceRef;
294-
use rustc::mir::Projection;
295294

296295
// Dereference. You cannot move things out from a borrowed value.
297296
let mut deref = false;
@@ -303,7 +302,7 @@ fn base_local_and_movability<'tcx>(
303302
mut projection,
304303
} = place.as_ref();
305304
if let PlaceBase::Local(local) = place_base {
306-
while let Some(box Projection { base, elem }) = projection {
305+
while let [base @ .., elem] = projection {
307306
projection = base;
308307
deref = matches!(elem, mir::ProjectionElem::Deref);
309308
field = !field

0 commit comments

Comments
 (0)