diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-09 22:47:34 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-09 22:47:34 +0100 |
commit | 176f7f61175bc433c56083a758bd7a28a8ae31f8 (patch) | |
tree | cca4821454502279317323fbc63dccdb9c68c5b9 /crates/ra_hir_def/src/body | |
parent | eb07803e8106a66edfd80d078337dae240e92828 (diff) | |
parent | 30084a56a5731343bd4cec727646a6c55900234f (diff) |
Merge #3923
3923: Cleanup keyword accessors r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/body')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index df560155c..b0d71eb3d 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -372,7 +372,7 @@ impl ExprCollector<'_> { | |||
372 | } | 372 | } |
373 | ast::Expr::RefExpr(e) => { | 373 | ast::Expr::RefExpr(e) => { |
374 | let expr = self.collect_expr_opt(e.expr()); | 374 | let expr = self.collect_expr_opt(e.expr()); |
375 | let mutability = Mutability::from_mutable(e.is_mut()); | 375 | let mutability = Mutability::from_mutable(e.mut_token().is_some()); |
376 | self.alloc_expr(Expr::Ref { expr, mutability }, syntax_ptr) | 376 | self.alloc_expr(Expr::Ref { expr, mutability }, syntax_ptr) |
377 | } | 377 | } |
378 | ast::Expr::PrefixExpr(e) => { | 378 | ast::Expr::PrefixExpr(e) => { |
@@ -587,10 +587,8 @@ impl ExprCollector<'_> { | |||
587 | let pattern = match &pat { | 587 | let pattern = match &pat { |
588 | ast::Pat::BindPat(bp) => { | 588 | ast::Pat::BindPat(bp) => { |
589 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); | 589 | let name = bp.name().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); |
590 | let annotation = BindingAnnotation::new( | 590 | let annotation = |
591 | bp.mut_kw_token().is_some(), | 591 | BindingAnnotation::new(bp.mut_token().is_some(), bp.ref_token().is_some()); |
592 | bp.ref_kw_token().is_some(), | ||
593 | ); | ||
594 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); | 592 | let subpat = bp.pat().map(|subpat| self.collect_pat(subpat)); |
595 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { | 593 | if annotation == BindingAnnotation::Unannotated && subpat.is_none() { |
596 | // This could also be a single-segment path pattern. To | 594 | // This could also be a single-segment path pattern. To |
@@ -631,7 +629,7 @@ impl ExprCollector<'_> { | |||
631 | } | 629 | } |
632 | ast::Pat::RefPat(p) => { | 630 | ast::Pat::RefPat(p) => { |
633 | let pat = self.collect_pat_opt(p.pat()); | 631 | let pat = self.collect_pat_opt(p.pat()); |
634 | let mutability = Mutability::from_mutable(p.mut_kw_token().is_some()); | 632 | let mutability = Mutability::from_mutable(p.mut_token().is_some()); |
635 | Pat::Ref { pat, mutability } | 633 | Pat::Ref { pat, mutability } |
636 | } | 634 | } |
637 | ast::Pat::PathPat(p) => { | 635 | ast::Pat::PathPat(p) => { |