Skip to content

Commit ae82c75

Browse files
committed
Remove Analysis::into_engine.
This is a standard pattern: ``` MyAnalysis.into_engine(tcx, body).iterate_to_fixpoint() ``` `into_engine` and `iterate_to_fixpoint` are always called in pairs, but sometimes with a builder-style `pass_name` call between them. But a builder-style interface is overkill here. This has been bugging me a for a while. This commit: - Merges `Engine::new` and `Engine::iterate_to_fixpoint`. This removes the need for `Engine` to have fields, leaving it as a trivial type that the next commit will remove. - Renames `Analysis::into_engine` as `Analysis::iterate_to_fixpoint`, gives it an extra argument for the optional pass name, and makes it call `Engine::iterate_to_fixpoint` instead of `Engine::new`. This turns the pattern from above into this: ``` MyAnalysis.iterate_to_fixpoint(tcx, body, None) ``` which is shorter at every call site, and there's less plumbing required to support it.
1 parent 1d0dad5 commit ae82c75

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

clippy_utils/src/mir/possible_borrower.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,7 @@ impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
185185
vis.into_map(cx)
186186
};
187187
let maybe_storage_live_result = MaybeStorageLive::new(Cow::Owned(BitSet::new_empty(mir.local_decls.len())))
188-
.into_engine(cx.tcx, mir)
189-
.pass_name("redundant_clone")
190-
.iterate_to_fixpoint()
188+
.iterate_to_fixpoint(cx.tcx, mir, Some("redundant_clone"))
191189
.into_results_cursor(mir);
192190
let mut vis = PossibleBorrowerVisitor::new(cx, mir, possible_origin);
193191
vis.visit_body(mir);

0 commit comments

Comments
 (0)