diff options
Diffstat (limited to 'crates/ra_hir/src/expr.rs')
-rw-r--r-- | crates/ra_hir/src/expr.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 893bad9cd..e7235c1a1 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs | |||
@@ -332,7 +332,7 @@ impl_arena_id!(PatId); | |||
332 | #[derive(Debug, Clone, Eq, PartialEq)] | 332 | #[derive(Debug, Clone, Eq, PartialEq)] |
333 | pub struct FieldPat { | 333 | pub struct FieldPat { |
334 | pub(crate) name: Name, | 334 | pub(crate) name: Name, |
335 | pub(crate) pat: Option<PatId>, | 335 | pub(crate) pat: PatId, |
336 | } | 336 | } |
337 | 337 | ||
338 | /// Close relative to rustc's hir::PatKind | 338 | /// Close relative to rustc's hir::PatKind |
@@ -393,7 +393,7 @@ impl Pat { | |||
393 | total_iter.map(|pat| *pat).for_each(f); | 393 | total_iter.map(|pat| *pat).for_each(f); |
394 | } | 394 | } |
395 | Pat::Struct { args, .. } => { | 395 | Pat::Struct { args, .. } => { |
396 | args.iter().filter_map(|a| a.pat).for_each(f); | 396 | args.iter().map(|f| f.pat).for_each(f); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | } | 399 | } |
@@ -821,9 +821,10 @@ impl ExprCollector { | |||
821 | .expect("every struct should have a field list") | 821 | .expect("every struct should have a field list") |
822 | .field_pats() | 822 | .field_pats() |
823 | .into_iter() | 823 | .into_iter() |
824 | .map(|f| FieldPat { | 824 | .map(|f| { |
825 | name: Name::new(f.ident), | 825 | let name = Name::new(f.ident); |
826 | pat: f.pat.as_ref().map(|p| self.collect_pat(p)), | 826 | let pat = self.collect_pat(&*f.pat); |
827 | FieldPat { name, pat } | ||
827 | }) | 828 | }) |
828 | .collect(); | 829 | .collect(); |
829 | 830 | ||