Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Dec 2, 2019
1 parent 574f3fd commit 286b39d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
) {
let def_id = cx.tcx.hir().body_owner_def_id(body.id());
let mir = cx.tcx.optimized_mir(def_id);
let mir_read_only = mir.unwrap_read_only();

let dead_unwinds = BitSet::new_empty(mir.basic_blocks().len());
let maybe_storage_live_result = do_dataflow(
Expand All @@ -94,7 +95,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
);
let mut possible_borrower = {
let mut vis = PossibleBorrowerVisitor::new(cx, mir);
vis.visit_body(mir);
vis.visit_body(mir_read_only);
vis.into_map(cx, maybe_storage_live_result)
};

Expand Down Expand Up @@ -146,7 +147,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
// `arg` is a reference as it is `.deref()`ed in the previous block.
// Look into the predecessor block and find out the source of deref.

let ps = mir.predecessors_for(bb);
let ps = mir_read_only.predecessors_for(bb);
if ps.len() != 1 {
continue;
}
Expand Down

0 comments on commit 286b39d

Please sign in to comment.