Skip to content

Commit

Permalink
Fix clippy error
Browse files Browse the repository at this point in the history
  • Loading branch information
hkmatsumoto committed Oct 18, 2020
1 parent 042fbcc commit fa1763f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,11 @@ fn find_stmt_assigns_to<'tcx>(

match (by_ref, &*rvalue) {
(true, mir::Rvalue::Ref(_, _, place)) | (false, mir::Rvalue::Use(mir::Operand::Copy(place))) => {
base_local_and_movability(cx, mir, *place)
Some(base_local_and_movability(cx, mir, *place))
},
(false, mir::Rvalue::Ref(_, _, place)) => {
if let [mir::ProjectionElem::Deref] = place.as_ref().projection {
base_local_and_movability(cx, mir, *place)
Some(base_local_and_movability(cx, mir, *place))
} else {
None
}
Expand All @@ -339,7 +339,7 @@ fn base_local_and_movability<'tcx>(
cx: &LateContext<'tcx>,
mir: &mir::Body<'tcx>,
place: mir::Place<'tcx>,
) -> Option<(mir::Local, CannotMoveOut)> {
) -> (mir::Local, CannotMoveOut) {
use rustc_middle::mir::PlaceRef;

// Dereference. You cannot move things out from a borrowed value.
Expand All @@ -360,7 +360,7 @@ fn base_local_and_movability<'tcx>(
&& !is_copy(cx, mir::Place::ty_from(local, projection, &mir.local_decls, cx.tcx).ty);
}

Some((local, deref || field || slice))
(local, deref || field || slice)
}

struct LocalUseVisitor {
Expand Down

0 comments on commit fa1763f

Please sign in to comment.