diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-12 10:39:01 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-09-13 15:29:57 +1000 |
| commit | 0b59bba6ec40031f9fee5c598abdbaaa3ff20dea (patch) | |
| tree | e841f38ced34ded8c5d48d8a7a648fa6af5849c7 | |
| parent | 51383998857d74eb1d9d13c8825a895b61fa5b49 (diff) | |
| download | rust-0b59bba6ec40031f9fee5c598abdbaaa3ff20dea.tar.gz rust-0b59bba6ec40031f9fee5c598abdbaaa3ff20dea.zip | |
Remove unnecessary lifetime from `CheckLoopVisitor`.
| -rw-r--r-- | compiler/rustc_passes/src/loops.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index c11562ae39e..9afd8ad47ad 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -64,8 +64,8 @@ impl fmt::Display for BreakContextKind { } #[derive(Clone)] -struct CheckLoopVisitor<'a, 'tcx> { - sess: &'a Session, +struct CheckLoopVisitor<'tcx> { + sess: &'tcx Session, tcx: TyCtxt<'tcx>, // Keep track of a stack of contexts, so that suggestions // are not made for contexts where it would be incorrect, @@ -90,7 +90,7 @@ pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_loops, ..*providers }; } -impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { +impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> { type NestedFilter = nested_filter::OnlyBodies; fn nested_visit_map(&mut self) -> Self::Map { @@ -129,7 +129,7 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { hir::ExprKind::If(cond, then, else_opt) => { self.visit_expr(cond); - let get_block = |ck_loop: &CheckLoopVisitor<'a, 'hir>, + let get_block = |ck_loop: &CheckLoopVisitor<'hir>, expr: &hir::Expr<'hir>| -> Option<&hir::Block<'hir>> { if let hir::ExprKind::Block(b, None) = expr.kind @@ -306,10 +306,10 @@ impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { } } -impl<'a, 'hir> CheckLoopVisitor<'a, 'hir> { +impl<'hir> CheckLoopVisitor<'hir> { fn with_context<F>(&mut self, cx: Context, f: F) where - F: FnOnce(&mut CheckLoopVisitor<'a, 'hir>), + F: FnOnce(&mut CheckLoopVisitor<'hir>), { self.cx_stack.push(cx); f(self); |
