1
Fork 0

Auto merge of #96863 - SparrowLii:let, r=michaelwoerister

use `hir::Let` in `hir::Guard::IfLet`

This PR fixes the FIXME about using `hir::Let` in `hir::Guard::IfLet`
This commit is contained in:
bors 2022-05-18 17:48:46 +00:00
commit 07ae142d77
18 changed files with 55 additions and 57 deletions

View file

@ -1320,8 +1320,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

@ -1225,9 +1225,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);
}
}
}