diff options
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 4d372c97b..c05bbc442 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -398,7 +398,7 @@ pub enum Pat { | |||
398 | Bind { | 398 | Bind { |
399 | mode: BindingAnnotation, | 399 | mode: BindingAnnotation, |
400 | name: Name, | 400 | name: Name, |
401 | sub_pat: Option<PatId>, | 401 | subpat: Option<PatId>, |
402 | }, | 402 | }, |
403 | TupleStruct { | 403 | TupleStruct { |
404 | path: Option<Path>, | 404 | path: Option<Path>, |
@@ -413,12 +413,10 @@ pub enum Pat { | |||
413 | impl Pat { | 413 | impl Pat { |
414 | pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) { | 414 | pub fn walk_child_pats(&self, mut f: impl FnMut(PatId)) { |
415 | match self { | 415 | match self { |
416 | Pat::Range { .. } | 416 | Pat::Range { .. } | Pat::Lit(..) | Pat::Path(..) | Pat::Wild | Pat::Missing => {} |
417 | | Pat::Lit(..) | 417 | Pat::Bind { subpat, .. } => { |
418 | | Pat::Path(..) | 418 | subpat.iter().map(|pat| *pat).for_each(f); |
419 | | Pat::Wild | 419 | } |
420 | | Pat::Missing | ||
421 | | Pat::Bind { .. } => {} | ||
422 | Pat::Tuple(args) | Pat::TupleStruct { args, .. } => { | 420 | Pat::Tuple(args) | Pat::TupleStruct { args, .. } => { |
423 | args.iter().map(|pat| *pat).for_each(f); | 421 | args.iter().map(|pat| *pat).for_each(f); |
424 | } | 422 | } |
@@ -833,11 +831,11 @@ impl ExprCollector { | |||
833 | .map(|nr| nr.as_name()) | 831 | .map(|nr| nr.as_name()) |
834 | .unwrap_or_else(Name::missing); | 832 | .unwrap_or_else(Name::missing); |
835 | let annotation = BindingAnnotation::new(bp.is_mutable(), bp.is_ref()); | 833 | let annotation = BindingAnnotation::new(bp.is_mutable(), bp.is_ref()); |
836 | let sub_pat = bp.pat().map(|subpat| self.collect_pat(subpat)); | 834 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); |
837 | Pat::Bind { | 835 | Pat::Bind { |
838 | name, | 836 | name, |
839 | mode: annotation, | 837 | mode: annotation, |
840 | sub_pat, | 838 | subpat, |
841 | } | 839 | } |
842 | } | 840 | } |
843 | ast::PatKind::TupleStructPat(p) => { | 841 | ast::PatKind::TupleStructPat(p) => { |
@@ -928,7 +926,7 @@ pub(crate) fn collect_fn_body_syntax(node: &ast::FnDef) -> BodySyntaxMapping { | |||
928 | Pat::Bind { | 926 | Pat::Bind { |
929 | name: Name::self_param(), | 927 | name: Name::self_param(), |
930 | mode: BindingAnnotation::Unannotated, | 928 | mode: BindingAnnotation::Unannotated, |
931 | sub_pat: None, | 929 | subpat: None, |
932 | }, | 930 | }, |
933 | self_param, | 931 | self_param, |
934 | ); | 932 | ); |