diff options
author | Aleksey Kladov <[email protected]> | 2020-04-09 17:40:43 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-04-09 17:48:13 +0100 |
commit | 2bfb65db93e48d8f9e8ecac0b2ea837c081a4db5 (patch) | |
tree | 8a518f7fadab6918dea225122a69c8fd040e0fc1 /crates/ra_hir_def/src/body/lower.rs | |
parent | e6d22187a67e762bb950de244a6ca15f3a0b0731 (diff) |
Be consistent about token accesors
Diffstat (limited to 'crates/ra_hir_def/src/body/lower.rs')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index b02de5d67..c4a5ec59c 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -572,7 +572,10 @@ impl ExprCollector<'_> { | |||
572 | let pattern = match &pat { | 572 | let pattern = match &pat { |
573 | ast::Pat::BindPat(bp) => { | 573 | ast::Pat::BindPat(bp) => { |
574 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); | 574 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); |
575 | let annotation = BindingAnnotation::new(bp.is_mutable(), bp.is_ref()); | 575 | let annotation = BindingAnnotation::new( |
576 | bp.mut_kw_token().is_some(), | ||
577 | bp.ref_kw_token().is_some(), | ||
578 | ); | ||
576 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); | 579 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); |
577 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { | 580 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { |
578 | // This could also be a single-segment path pattern. To | 581 | // This could also be a single-segment path pattern. To |
@@ -613,7 +616,7 @@ impl ExprCollector<'_> { | |||
613 | } | 616 | } |
614 | ast::Pat::RefPat(p) => { | 617 | ast::Pat::RefPat(p) => { |
615 | let pat = self.collect_pat_opt(p.pat()); | 618 | let pat = self.collect_pat_opt(p.pat()); |
616 | let mutability = Mutability::from_mutable(p.is_mut()); | 619 | let mutability = Mutability::from_mutable(p.mut_kw_token().is_some()); |
617 | Pat::Ref { pat, mutability } | 620 | Pat::Ref { pat, mutability } |
618 | } | 621 | } |
619 | ast::Pat::PathPat(p) => { | 622 | ast::Pat::PathPat(p) => { |