Skip to content

Commit d01a498

Browse files
committed
Auto merge of rust-lang#5508 - lzutao:rustup-71044, r=phansch
Rustup "Remove `BodyAndCache`" cc rust-lang#71044 changelog: none
2 parents 1d4dd3d + 3f6f392 commit d01a498

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_lints/src/redundant_clone.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
8585
}
8686

8787
let mir = cx.tcx.optimized_mir(def_id.to_def_id());
88-
let mir_read_only = mir.unwrap_read_only();
8988

9089
let maybe_storage_live_result = MaybeStorageLive
9190
.into_engine(cx.tcx, mir, def_id.to_def_id())
9291
.iterate_to_fixpoint()
9392
.into_results_cursor(mir);
9493
let mut possible_borrower = {
9594
let mut vis = PossibleBorrowerVisitor::new(cx, mir);
96-
vis.visit_body(&mir_read_only);
95+
vis.visit_body(&mir);
9796
vis.into_map(cx, maybe_storage_live_result)
9897
};
9998

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

149-
let ps = mir_read_only.predecessors_for(bb);
148+
let ps = &mir.predecessors()[bb];
150149
if ps.len() != 1 {
151150
continue;
152151
}
@@ -191,7 +190,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone {
191190
(local, deref_clone_ret)
192191
};
193192

194-
let is_temp = mir_read_only.local_kind(ret_local) == mir::LocalKind::Temp;
193+
let is_temp = mir.local_kind(ret_local) == mir::LocalKind::Temp;
195194

196195
// 1. `local` can be moved out if it is not used later.
197196
// 2. If `ret_local` is a temporary and is neither consumed nor mutated, we can remove this `clone`

0 commit comments

Comments
 (0)