Skip to content

Commit 4d78fd1

Browse files
feat: remove callback param for walk_local method
1 parent e38954c commit 4d78fd1

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

compiler/rustc_hir_typeck/src/expr_use_visitor.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
451451
}
452452

453453
hir::ExprKind::Let(hir::LetExpr { pat, init, .. }) => {
454-
self.walk_local(init, pat, None, || Ok(()))?;
454+
self.walk_local(init, pat, None)?;
455455
}
456456

457457
hir::ExprKind::Match(discr, arms, _) => {
@@ -577,7 +577,7 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
577577
fn walk_stmt(&self, stmt: &hir::Stmt<'_>) -> Result<(), Cx::Error> {
578578
match stmt.kind {
579579
hir::StmtKind::Let(hir::LetStmt { pat, init: Some(expr), els, .. }) => {
580-
self.walk_local(expr, pat, *els, || Ok(()))?;
580+
self.walk_local(expr, pat, *els)?;
581581
}
582582

583583
hir::StmtKind::Let(_) => {}
@@ -617,19 +617,14 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
617617
Ok(())
618618
}
619619

620-
fn walk_local<F>(
620+
fn walk_local(
621621
&self,
622622
expr: &hir::Expr<'_>,
623623
pat: &hir::Pat<'_>,
624624
els: Option<&hir::Block<'_>>,
625-
mut f: F,
626-
) -> Result<(), Cx::Error>
627-
where
628-
F: FnMut() -> Result<(), Cx::Error>,
629-
{
625+
) -> Result<(), Cx::Error> {
630626
self.walk_expr(expr)?;
631627
let expr_place = self.cat_expr(expr)?;
632-
f()?;
633628
self.fake_read_scrutinee(&expr_place, els.is_some())?;
634629
self.walk_pat(&expr_place, pat, false)?;
635630
if let Some(els) = els {

0 commit comments

Comments
 (0)