about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-04-23 05:08:29 +0000
committerbors <bors@rust-lang.org>2020-04-23 05:08:29 +0000
commitd01a49810b97543cb783970ba0d3e27ccafb8fa8 (patch)
tree788c50bc700e4d493e8875107dda32ec676ae07c
parent1d4dd3d428cf6a622dc863a134ffacdb2183b6db (diff)
parent3f6f39273038eb58a0e2e49983de267571eec437 (diff)
downloadrust-d01a49810b97543cb783970ba0d3e27ccafb8fa8.tar.gz
rust-d01a49810b97543cb783970ba0d3e27ccafb8fa8.zip
Auto merge of #5508 - lzutao:rustup-71044, r=phansch
Rustup "Remove `BodyAndCache`"

cc https://github.com/rust-lang/rust/pull/71044
changelog: none
-rw-r--r--clippy_lints/src/redundant_clone.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs
index 898bd2aef8b..a0e2c3c486a 100644
--- a/clippy_lints/src/redundant_clone.rs
+++ b/clippy_lints/src/redundant_clone.rs
@@ -85,7 +85,6 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
         }
 
         let mir = cx.tcx.optimized_mir(def_id.to_def_id());
-        let mir_read_only = mir.unwrap_read_only();
 
         let maybe_storage_live_result = MaybeStorageLive
             .into_engine(cx.tcx, mir, def_id.to_def_id())
@@ -93,7 +92,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
             .into_results_cursor(mir);
         let mut possible_borrower = {
             let mut vis = PossibleBorrowerVisitor::new(cx, mir);
-            vis.visit_body(&mir_read_only);
+            vis.visit_body(&mir);
             vis.into_map(cx, maybe_storage_live_result)
         };
 
@@ -146,7 +145,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_read_only.predecessors_for(bb);
+                let ps = &mir.predecessors()[bb];
                 if ps.len() != 1 {
                     continue;
                 }
@@ -191,7 +190,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
                 (local, deref_clone_ret)
             };
 
-            let is_temp = mir_read_only.local_kind(ret_local) == mir::LocalKind::Temp;
+            let is_temp = mir.local_kind(ret_local) == mir::LocalKind::Temp;
 
             // 1. `local` can be moved out if it is not used later.
             // 2. If `ret_local` is a temporary and is neither consumed nor mutated, we can remove this `clone`