aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-18 18:21:44 +0000
committerGitHub <[email protected]>2019-11-18 18:21:44 +0000
commita4f21801c54c65eafa337edc5e86de2c46b37544 (patch)
tree08ba16832a712a8614bffb496c99d74c604481c6
parentd0713219732633e41c299467d0bb39ece7a64eb0 (diff)
parent27ce1e822b9b5e498aec8ce9efd8efc7c5a80b5f (diff)
Merge #2308
2308: Remove the custom impl of AttrsOwner for ImplItem r=matklad a=DJMcNab The default impl should have the same behaviour, and it can be generated by codegen. See also `ModuleItem` and `NominalDef`. Also see https://github.com/rust-analyzer/rust-analyzer/commit/5dbbfda34ae423229487595fd0ae9e727ae42906#r36011245 Co-authored-by: DJMcNab <[email protected]>
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs12
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1
-rw-r--r--crates/ra_syntax/src/grammar.ron3
3 files changed, 4 insertions, 12 deletions
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index cefc00402..761b2435c 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -2,7 +2,7 @@
2//! Extensions for various expressions live in a sibling `expr_extensions` module. 2//! Extensions for various expressions live in a sibling `expr_extensions` module.
3 3
4use crate::{ 4use crate::{
5 ast::{self, child_opt, children, AstChildren, AstNode, AttrInput, SyntaxNode}, 5 ast::{self, child_opt, children, AstNode, AttrInput, SyntaxNode},
6 SmolStr, SyntaxElement, 6 SmolStr, SyntaxElement,
7 SyntaxKind::*, 7 SyntaxKind::*,
8 SyntaxToken, T, 8 SyntaxToken, T,
@@ -176,16 +176,6 @@ impl ast::ImplBlock {
176 } 176 }
177} 177}
178 178
179impl ast::AttrsOwner for ast::ImplItem {
180 fn attrs(&self) -> AstChildren<ast::Attr> {
181 match self {
182 ast::ImplItem::FnDef(it) => it.attrs(),
183 ast::ImplItem::TypeAliasDef(it) => it.attrs(),
184 ast::ImplItem::ConstDef(it) => it.attrs(),
185 }
186 }
187}
188
189#[derive(Debug, Clone, PartialEq, Eq)] 179#[derive(Debug, Clone, PartialEq, Eq)]
190pub enum StructKind { 180pub enum StructKind {
191 Tuple(ast::TupleFieldDefList), 181 Tuple(ast::TupleFieldDefList),
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 34b22c3e2..2b381dcdb 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1298,6 +1298,7 @@ impl AstNode for ImplItem {
1298 } 1298 }
1299 } 1299 }
1300} 1300}
1301impl ast::AttrsOwner for ImplItem {}
1301impl ImplItem {} 1302impl ImplItem {}
1302#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1303#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1303pub struct ImplTraitType { 1304pub struct ImplTraitType {
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index 0a8fd0612..70d85a8e6 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -401,7 +401,8 @@ Grammar(
401 traits: ["AttrsOwner"] 401 traits: ["AttrsOwner"]
402 ), 402 ),
403 "ImplItem": ( 403 "ImplItem": (
404 enum: ["FnDef", "TypeAliasDef", "ConstDef"] 404 enum: ["FnDef", "TypeAliasDef", "ConstDef"],
405 traits: ["AttrsOwner"]
405 ), 406 ),
406 407
407 "TupleExpr": ( 408 "TupleExpr": (