aboutsummaryrefslogtreecommitdiff
path: root/crates/syntax/src/ast
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-02-07 11:15:26 +0000
committerGitHub <[email protected]>2021-02-07 11:15:26 +0000
commit336909b63a14b801520c6627d90d750babcfe280 (patch)
treeb5b73fc760b261fafda58a3e20e04b8e74559c60 /crates/syntax/src/ast
parent75a87ec198b25c5938c651ef087f9ebf923c34f8 (diff)
parent7022ea52b5f2a0262c2cd96b290ddb8ec0af0df9 (diff)
Merge #7587
7587: AdtDef -> Adt r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/syntax/src/ast')
-rw-r--r--crates/syntax/src/ast/generated/nodes.rs38
1 files changed, 19 insertions, 19 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs
index 5baa54a3f..064931aec 100644
--- a/crates/syntax/src/ast/generated/nodes.rs
+++ b/crates/syntax/src/ast/generated/nodes.rs
@@ -1401,15 +1401,15 @@ pub enum FieldList {
1401 TupleFieldList(TupleFieldList), 1401 TupleFieldList(TupleFieldList),
1402} 1402}
1403#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1403#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1404pub enum AdtDef { 1404pub enum Adt {
1405 Enum(Enum), 1405 Enum(Enum),
1406 Struct(Struct), 1406 Struct(Struct),
1407 Union(Union), 1407 Union(Union),
1408} 1408}
1409impl ast::AttrsOwner for AdtDef {} 1409impl ast::AttrsOwner for Adt {}
1410impl ast::GenericParamsOwner for AdtDef {} 1410impl ast::GenericParamsOwner for Adt {}
1411impl ast::NameOwner for AdtDef {} 1411impl ast::NameOwner for Adt {}
1412impl ast::VisibilityOwner for AdtDef {} 1412impl ast::VisibilityOwner for Adt {}
1413#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1413#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1414pub enum AssocItem { 1414pub enum AssocItem {
1415 Const(Const), 1415 Const(Const),
@@ -3394,16 +3394,16 @@ impl AstNode for FieldList {
3394 } 3394 }
3395 } 3395 }
3396} 3396}
3397impl From<Enum> for AdtDef { 3397impl From<Enum> for Adt {
3398 fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } 3398 fn from(node: Enum) -> Adt { Adt::Enum(node) }
3399} 3399}
3400impl From<Struct> for AdtDef { 3400impl From<Struct> for Adt {
3401 fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } 3401 fn from(node: Struct) -> Adt { Adt::Struct(node) }
3402} 3402}
3403impl From<Union> for AdtDef { 3403impl From<Union> for Adt {
3404 fn from(node: Union) -> AdtDef { AdtDef::Union(node) } 3404 fn from(node: Union) -> Adt { Adt::Union(node) }
3405} 3405}
3406impl AstNode for AdtDef { 3406impl AstNode for Adt {
3407 fn can_cast(kind: SyntaxKind) -> bool { 3407 fn can_cast(kind: SyntaxKind) -> bool {
3408 match kind { 3408 match kind {
3409 ENUM | STRUCT | UNION => true, 3409 ENUM | STRUCT | UNION => true,
@@ -3412,18 +3412,18 @@ impl AstNode for AdtDef {
3412 } 3412 }
3413 fn cast(syntax: SyntaxNode) -> Option<Self> { 3413 fn cast(syntax: SyntaxNode) -> Option<Self> {
3414 let res = match syntax.kind() { 3414 let res = match syntax.kind() {
3415 ENUM => AdtDef::Enum(Enum { syntax }), 3415 ENUM => Adt::Enum(Enum { syntax }),
3416 STRUCT => AdtDef::Struct(Struct { syntax }), 3416 STRUCT => Adt::Struct(Struct { syntax }),
3417 UNION => AdtDef::Union(Union { syntax }), 3417 UNION => Adt::Union(Union { syntax }),
3418 _ => return None, 3418 _ => return None,
3419 }; 3419 };
3420 Some(res) 3420 Some(res)
3421 } 3421 }
3422 fn syntax(&self) -> &SyntaxNode { 3422 fn syntax(&self) -> &SyntaxNode {
3423 match self { 3423 match self {
3424 AdtDef::Enum(it) => &it.syntax, 3424 Adt::Enum(it) => &it.syntax,
3425 AdtDef::Struct(it) => &it.syntax, 3425 Adt::Struct(it) => &it.syntax,
3426 AdtDef::Union(it) => &it.syntax, 3426 Adt::Union(it) => &it.syntax,
3427 } 3427 }
3428 } 3428 }
3429} 3429}
@@ -3571,7 +3571,7 @@ impl std::fmt::Display for FieldList {
3571 std::fmt::Display::fmt(self.syntax(), f) 3571 std::fmt::Display::fmt(self.syntax(), f)
3572 } 3572 }
3573} 3573}
3574impl std::fmt::Display for AdtDef { 3574impl std::fmt::Display for Adt {
3575 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3575 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3576 std::fmt::Display::fmt(self.syntax(), f) 3576 std::fmt::Display::fmt(self.syntax(), f)
3577 } 3577 }