hir: Remove unnecessary HirId
from hir::Let
It has 1-to-1 correspondence to its expression id. Also remove mostly useless `visit_let_expr`.
This commit is contained in:
parent
6b4f1c5e78
commit
5f8030dcc9
6 changed files with 17 additions and 28 deletions
|
@ -1273,7 +1273,6 @@ pub struct Arm<'hir> {
|
|||
/// desugaring to if-let. Only let-else supports the type annotation at present.
|
||||
#[derive(Debug, Clone, Copy, HashStable_Generic)]
|
||||
pub struct Let<'hir> {
|
||||
pub hir_id: HirId,
|
||||
pub span: Span,
|
||||
pub pat: &'hir Pat<'hir>,
|
||||
pub ty: Option<&'hir Ty<'hir>>,
|
||||
|
|
|
@ -341,9 +341,6 @@ pub trait Visitor<'v>: Sized {
|
|||
fn visit_expr(&mut self, ex: &'v Expr<'v>) {
|
||||
walk_expr(self, ex)
|
||||
}
|
||||
fn visit_let_expr(&mut self, lex: &'v Let<'v>) {
|
||||
walk_let_expr(self, lex)
|
||||
}
|
||||
fn visit_expr_field(&mut self, field: &'v ExprField<'v>) {
|
||||
walk_expr_field(self, field)
|
||||
}
|
||||
|
@ -729,7 +726,12 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
|
|||
ExprKind::DropTemps(ref subexpression) => {
|
||||
visitor.visit_expr(subexpression);
|
||||
}
|
||||
ExprKind::Let(ref let_expr) => visitor.visit_let_expr(let_expr),
|
||||
ExprKind::Let(Let { span: _, pat, ty, init, is_recovered: _ }) => {
|
||||
// match the visit order in walk_local
|
||||
visitor.visit_expr(init);
|
||||
visitor.visit_pat(pat);
|
||||
walk_list!(visitor, visit_ty, ty);
|
||||
}
|
||||
ExprKind::If(ref cond, ref then, ref else_opt) => {
|
||||
visitor.visit_expr(cond);
|
||||
visitor.visit_expr(then);
|
||||
|
@ -806,14 +808,6 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
|
|||
}
|
||||
}
|
||||
|
||||
pub fn walk_let_expr<'v, V: Visitor<'v>>(visitor: &mut V, let_expr: &'v Let<'v>) {
|
||||
// match the visit order in walk_local
|
||||
visitor.visit_expr(let_expr.init);
|
||||
visitor.visit_id(let_expr.hir_id);
|
||||
visitor.visit_pat(let_expr.pat);
|
||||
walk_list!(visitor, visit_ty, let_expr.ty);
|
||||
}
|
||||
|
||||
pub fn walk_expr_field<'v, V: Visitor<'v>>(visitor: &mut V, field: &'v ExprField<'v>) {
|
||||
visitor.visit_id(field.hir_id);
|
||||
visitor.visit_ident(field.ident);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue