aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-06 08:57:00 +0100
committerBenjamin Coenen <[email protected]>2020-05-06 08:57:00 +0100
commitc4d128e454448191c4b21d8e151c673e4c42376e (patch)
tree17cf5bbf429642c52708cd0d3c1d8885b63543f0 /crates/ra_syntax/src/ast
parent0bf02f5ccac99c91f10ef46bb06ff2ea316c382c (diff)
parent30eb458b4fa8adcecd8cbf731bd1cfa9a7a8b88b (diff)
Merge branch 'master' of github.com:rust-analyzer/rust-analyzer into fix_4311
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/edit.rs6
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs36
2 files changed, 21 insertions, 21 deletions
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs
index c507dc683..3e6dd6061 100644
--- a/crates/ra_syntax/src/ast/edit.rs
+++ b/crates/ra_syntax/src/ast/edit.rs
@@ -79,7 +79,7 @@ where
79 79
80impl ast::ItemList { 80impl ast::ItemList {
81 #[must_use] 81 #[must_use]
82 pub fn append_items(&self, items: impl IntoIterator<Item = ast::ImplItem>) -> ast::ItemList { 82 pub fn append_items(&self, items: impl IntoIterator<Item = ast::AssocItem>) -> ast::ItemList {
83 let mut res = self.clone(); 83 let mut res = self.clone();
84 if !self.syntax().text().contains_char('\n') { 84 if !self.syntax().text().contains_char('\n') {
85 res = make_multiline(res); 85 res = make_multiline(res);
@@ -89,8 +89,8 @@ impl ast::ItemList {
89 } 89 }
90 90
91 #[must_use] 91 #[must_use]
92 pub fn append_item(&self, item: ast::ImplItem) -> ast::ItemList { 92 pub fn append_item(&self, item: ast::AssocItem) -> ast::ItemList {
93 let (indent, position) = match self.impl_items().last() { 93 let (indent, position) = match self.assoc_items().last() {
94 Some(it) => ( 94 Some(it) => (
95 leading_indent(it.syntax()).unwrap_or_default().to_string(), 95 leading_indent(it.syntax()).unwrap_or_default().to_string(),
96 InsertPosition::After(it.syntax().clone().into()), 96 InsertPosition::After(it.syntax().clone().into()),
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index c2cc25958..b00c15608 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -196,7 +196,7 @@ pub struct ItemList {
196impl ast::ModuleItemOwner for ItemList {} 196impl ast::ModuleItemOwner for ItemList {}
197impl ItemList { 197impl ItemList {
198 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 198 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
199 pub fn impl_items(&self) -> AstChildren<ImplItem> { support::children(&self.syntax) } 199 pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) }
200 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 200 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
201} 201}
202 202
@@ -1429,13 +1429,13 @@ impl ast::AttrsOwner for ModuleItem {}
1429impl ast::VisibilityOwner for ModuleItem {} 1429impl ast::VisibilityOwner for ModuleItem {}
1430 1430
1431#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1431#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1432pub enum ImplItem { 1432pub enum AssocItem {
1433 FnDef(FnDef), 1433 FnDef(FnDef),
1434 TypeAliasDef(TypeAliasDef), 1434 TypeAliasDef(TypeAliasDef),
1435 ConstDef(ConstDef), 1435 ConstDef(ConstDef),
1436} 1436}
1437impl ast::NameOwner for ImplItem {} 1437impl ast::NameOwner for AssocItem {}
1438impl ast::AttrsOwner for ImplItem {} 1438impl ast::AttrsOwner for AssocItem {}
1439 1439
1440#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1440#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1441pub enum ExternItem { 1441pub enum ExternItem {
@@ -3167,16 +3167,16 @@ impl AstNode for ModuleItem {
3167 } 3167 }
3168 } 3168 }
3169} 3169}
3170impl From<FnDef> for ImplItem { 3170impl From<FnDef> for AssocItem {
3171 fn from(node: FnDef) -> ImplItem { ImplItem::FnDef(node) } 3171 fn from(node: FnDef) -> AssocItem { AssocItem::FnDef(node) }
3172} 3172}
3173impl From<TypeAliasDef> for ImplItem { 3173impl From<TypeAliasDef> for AssocItem {
3174 fn from(node: TypeAliasDef) -> ImplItem { ImplItem::TypeAliasDef(node) } 3174 fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) }
3175} 3175}
3176impl From<ConstDef> for ImplItem { 3176impl From<ConstDef> for AssocItem {
3177 fn from(node: ConstDef) -> ImplItem { ImplItem::ConstDef(node) } 3177 fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) }
3178} 3178}
3179impl AstNode for ImplItem { 3179impl AstNode for AssocItem {
3180 fn can_cast(kind: SyntaxKind) -> bool { 3180 fn can_cast(kind: SyntaxKind) -> bool {
3181 match kind { 3181 match kind {
3182 FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true, 3182 FN_DEF | TYPE_ALIAS_DEF | CONST_DEF => true,
@@ -3185,18 +3185,18 @@ impl AstNode for ImplItem {
3185 } 3185 }
3186 fn cast(syntax: SyntaxNode) -> Option<Self> { 3186 fn cast(syntax: SyntaxNode) -> Option<Self> {
3187 let res = match syntax.kind() { 3187 let res = match syntax.kind() {
3188 FN_DEF => ImplItem::FnDef(FnDef { syntax }), 3188 FN_DEF => AssocItem::FnDef(FnDef { syntax }),
3189 TYPE_ALIAS_DEF => ImplItem::TypeAliasDef(TypeAliasDef { syntax }), 3189 TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }),
3190 CONST_DEF => ImplItem::ConstDef(ConstDef { syntax }), 3190 CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }),
3191 _ => return None, 3191 _ => return None,
3192 }; 3192 };
3193 Some(res) 3193 Some(res)
3194 } 3194 }
3195 fn syntax(&self) -> &SyntaxNode { 3195 fn syntax(&self) -> &SyntaxNode {
3196 match self { 3196 match self {
3197 ImplItem::FnDef(it) => &it.syntax, 3197 AssocItem::FnDef(it) => &it.syntax,
3198 ImplItem::TypeAliasDef(it) => &it.syntax, 3198 AssocItem::TypeAliasDef(it) => &it.syntax,
3199 ImplItem::ConstDef(it) => &it.syntax, 3199 AssocItem::ConstDef(it) => &it.syntax,
3200 } 3200 }
3201 } 3201 }
3202} 3202}
@@ -3641,7 +3641,7 @@ impl std::fmt::Display for ModuleItem {
3641 std::fmt::Display::fmt(self.syntax(), f) 3641 std::fmt::Display::fmt(self.syntax(), f)
3642 } 3642 }
3643} 3643}
3644impl std::fmt::Display for ImplItem { 3644impl std::fmt::Display for AssocItem {
3645 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 3645 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3646 std::fmt::Display::fmt(self.syntax(), f) 3646 std::fmt::Display::fmt(self.syntax(), f)
3647 } 3647 }