about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2020-07-31 21:58:36 +0200
committerAleksey Kladov <aleksey.kladov@gmail.com>2020-07-31 22:04:12 +0200
commitb9c6aa9ec9e491160a6ad7c5ec66151bd67b0ecd (patch)
tree0ab0318ef1bd2bea1834fbe2ec0c899b5dd6189b
parent675e86becfab2615528152487db49bce1b43bd60 (diff)
downloadrust-b9c6aa9ec9e491160a6ad7c5ec66151bd67b0ecd.tar.gz
rust-b9c6aa9ec9e491160a6ad7c5ec66151bd67b0ecd.zip
Unify naming of tuple fields
-rw-r--r--crates/ra_assists/src/handlers/early_return.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs6
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs8
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs2
-rw-r--r--xtask/src/codegen/rust.ungram8
5 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs
index 3650289fd64..69852b61161 100644
--- a/crates/ra_assists/src/handlers/early_return.rs
+++ b/crates/ra_assists/src/handlers/early_return.rs
@@ -51,11 +51,11 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
     // Check if there is an IfLet that we can handle.
     let if_let_pat = match cond.pat() {
         None => None, // No IfLet, supported.
-        Some(ast::Pat::TupleStructPat(pat)) if pat.args().count() == 1 => {
+        Some(ast::Pat::TupleStructPat(pat)) if pat.fields().count() == 1 => {
             let path = pat.path()?;
             match path.qualifier() {
                 None => {
-                    let bound_ident = pat.args().next().unwrap();
+                    let bound_ident = pat.fields().next().unwrap();
                     Some((path, bound_ident))
                 }
                 Some(_) => return None,
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 0d0365370d8..9d6562c38c0 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -496,7 +496,7 @@ impl ExprCollector<'_> {
                 self.alloc_expr(Expr::BinaryOp { lhs, rhs, op }, syntax_ptr)
             }
             ast::Expr::TupleExpr(e) => {
-                let exprs = e.exprs().map(|expr| self.collect_expr(expr)).collect();
+                let exprs = e.fields().map(|expr| self.collect_expr(expr)).collect();
                 self.alloc_expr(Expr::Tuple { exprs }, syntax_ptr)
             }
             ast::Expr::BoxExpr(e) => {
@@ -762,7 +762,7 @@ impl ExprCollector<'_> {
             }
             ast::Pat::TupleStructPat(p) => {
                 let path = p.path().and_then(|path| self.expander.parse_path(path));
-                let (args, ellipsis) = self.collect_tuple_pat(p.args());
+                let (args, ellipsis) = self.collect_tuple_pat(p.fields());
                 Pat::TupleStruct { path, args, ellipsis }
             }
             ast::Pat::RefPat(p) => {
@@ -780,7 +780,7 @@ impl ExprCollector<'_> {
             }
             ast::Pat::ParenPat(p) => return self.collect_pat_opt(p.pat()),
             ast::Pat::TuplePat(p) => {
-                let (args, ellipsis) = self.collect_tuple_pat(p.args());
+                let (args, ellipsis) = self.collect_tuple_pat(p.fields());
                 Pat::Tuple { args, ellipsis }
             }
             ast::Pat::WildcardPat(_) => Pat::Wild,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 6cb637b1d14..5f51c7536a5 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -893,7 +893,7 @@ pub struct TupleExpr {
 impl ast::AttrsOwner for TupleExpr {}
 impl TupleExpr {
     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
-    pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
+    pub fn fields(&self) -> AstChildren<Expr> { support::children(&self.syntax) }
     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1210,7 +1210,7 @@ pub struct SlicePat {
 }
 impl SlicePat {
     pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) }
-    pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
+    pub fn pats(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
     pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1219,7 +1219,7 @@ pub struct TuplePat {
 }
 impl TuplePat {
     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
-    pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
+    pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1229,7 +1229,7 @@ pub struct TupleStructPat {
 impl TupleStructPat {
     pub fn path(&self) -> Option<Path> { support::child(&self.syntax) }
     pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) }
-    pub fn args(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
+    pub fn fields(&self) -> AstChildren<Pat> { support::children(&self.syntax) }
     pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 2ffb83819d8..733e978772c 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -290,7 +290,7 @@ pub struct SlicePatComponents {
 
 impl ast::SlicePat {
     pub fn components(&self) -> SlicePatComponents {
-        let mut args = self.args().peekable();
+        let mut args = self.pats().peekable();
         let prefix = args
             .peeking_take_while(|p| match p {
                 ast::Pat::RestPat(_) => false,
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index b14801f2453..aca23890c6d 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -359,7 +359,7 @@ IndexExpr =
   Attr* base:Expr '[' index:Expr ']'
 
 TupleExpr =
-  Attr* '(' Attr* (Expr (',' Expr)* ','?)? ')'
+  Attr* '(' Attr* fields:(Expr (',' Expr)* ','?)? ')'
 
 RecordExpr =
   Path RecordExprFieldList
@@ -560,16 +560,16 @@ RecordPatField =
   Attr* (NameRef ':')? Pat
 
 TupleStructPat =
-   Path '(' args:(Pat (',' Pat)* ','?)? ')'
+   Path '(' fields:(Pat (',' Pat)* ','?)? ')'
 
 TuplePat =
-   '(' args:(Pat (',' Pat)* ','?)? ')'
+   '(' fields:(Pat (',' Pat)* ','?)? ')'
 
 ParenPat =
   '(' Pat ')'
 
 SlicePat =
-  '[' args:(Pat (',' Pat)* ','?)? ']'
+  '[' (Pat (',' Pat)* ','?)? ']'
 
 PathPat =
   Path