1
Fork 0

use hir::Let in hir::Guard

This commit is contained in:
SparrowLii 2022-05-09 20:35:58 +08:00
parent 4799baa70d
commit 5251a80c0a
13 changed files with 41 additions and 45 deletions

View file

@ -1312,8 +1312,7 @@ pub struct Let<'hir> {
#[derive(Debug, HashStable_Generic)]
pub enum Guard<'hir> {
If(&'hir Expr<'hir>),
// FIXME use hir::Let for this.
IfLet(&'hir Pat<'hir>, &'hir Expr<'hir>),
IfLet(&'hir Let<'hir>),
}
#[derive(Debug, HashStable_Generic)]

View file

@ -1233,9 +1233,8 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm<'v>) {
if let Some(ref g) = arm.guard {
match g {
Guard::If(ref e) => visitor.visit_expr(e),
Guard::IfLet(ref pat, ref e) => {
visitor.visit_pat(pat);
visitor.visit_expr(e);
Guard::IfLet(ref l) => {
visitor.visit_let_expr(l);
}
}
}