diff options
author | Aleksey Kladov <[email protected]> | 2020-07-29 14:11:48 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-29 14:12:19 +0100 |
commit | dc18ff51c38a9e602832508f4a3676176dbe113d (patch) | |
tree | 631c3a685be6d15eaa868d89185770814ee21ca1 | |
parent | e35804355797a50195718918efc6f7272786d62e (diff) |
Remove dead code
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 46 | ||||
-rw-r--r-- | xtask/src/ast_src.rs | 8 |
2 files changed, 0 insertions, 54 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 58141da11..01508ed88 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -1929,7 +1929,6 @@ pub struct TypeParamList { | |||
1929 | } | 1929 | } |
1930 | impl TypeParamList { | 1930 | impl TypeParamList { |
1931 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | 1931 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
1932 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } | ||
1933 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | 1932 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } |
1934 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | 1933 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } |
1935 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | 1934 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } |
@@ -2601,13 +2600,6 @@ pub enum NominalDef { | |||
2601 | impl ast::NameOwner for NominalDef {} | 2600 | impl ast::NameOwner for NominalDef {} |
2602 | impl ast::TypeParamsOwner for NominalDef {} | 2601 | impl ast::TypeParamsOwner for NominalDef {} |
2603 | impl ast::AttrsOwner for NominalDef {} | 2602 | impl ast::AttrsOwner for NominalDef {} |
2604 | /// Any kind of **declared** generic parameter | ||
2605 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2606 | pub enum GenericParam { | ||
2607 | LifetimeParam(LifetimeParam), | ||
2608 | TypeParam(TypeParam), | ||
2609 | ConstParam(ConstParam), | ||
2610 | } | ||
2611 | /// Any kind of generic argument passed at instantiation site | 2603 | /// Any kind of generic argument passed at instantiation site |
2612 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2604 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2613 | pub enum GenericArg { | 2605 | pub enum GenericArg { |
@@ -4155,39 +4147,6 @@ impl AstNode for NominalDef { | |||
4155 | } | 4147 | } |
4156 | } | 4148 | } |
4157 | } | 4149 | } |
4158 | impl From<LifetimeParam> for GenericParam { | ||
4159 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } | ||
4160 | } | ||
4161 | impl From<TypeParam> for GenericParam { | ||
4162 | fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } | ||
4163 | } | ||
4164 | impl From<ConstParam> for GenericParam { | ||
4165 | fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } | ||
4166 | } | ||
4167 | impl AstNode for GenericParam { | ||
4168 | fn can_cast(kind: SyntaxKind) -> bool { | ||
4169 | match kind { | ||
4170 | LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true, | ||
4171 | _ => false, | ||
4172 | } | ||
4173 | } | ||
4174 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
4175 | let res = match syntax.kind() { | ||
4176 | LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), | ||
4177 | TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), | ||
4178 | CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), | ||
4179 | _ => return None, | ||
4180 | }; | ||
4181 | Some(res) | ||
4182 | } | ||
4183 | fn syntax(&self) -> &SyntaxNode { | ||
4184 | match self { | ||
4185 | GenericParam::LifetimeParam(it) => &it.syntax, | ||
4186 | GenericParam::TypeParam(it) => &it.syntax, | ||
4187 | GenericParam::ConstParam(it) => &it.syntax, | ||
4188 | } | ||
4189 | } | ||
4190 | } | ||
4191 | impl From<LifetimeArg> for GenericArg { | 4150 | impl From<LifetimeArg> for GenericArg { |
4192 | fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } | 4151 | fn from(node: LifetimeArg) -> GenericArg { GenericArg::LifetimeArg(node) } |
4193 | } | 4152 | } |
@@ -4855,11 +4814,6 @@ impl std::fmt::Display for NominalDef { | |||
4855 | std::fmt::Display::fmt(self.syntax(), f) | 4814 | std::fmt::Display::fmt(self.syntax(), f) |
4856 | } | 4815 | } |
4857 | } | 4816 | } |
4858 | impl std::fmt::Display for GenericParam { | ||
4859 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4860 | std::fmt::Display::fmt(self.syntax(), f) | ||
4861 | } | ||
4862 | } | ||
4863 | impl std::fmt::Display for GenericArg { | 4817 | impl std::fmt::Display for GenericArg { |
4864 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4818 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4865 | std::fmt::Display::fmt(self.syntax(), f) | 4819 | std::fmt::Display::fmt(self.syntax(), f) |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 425814d73..8d1ffc5b5 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -1630,7 +1630,6 @@ pub(crate) fn rust_ast() -> AstSrc { | |||
1630 | /// [Reference](https://doc.rust-lang.org/reference/items/generics.html) | 1630 | /// [Reference](https://doc.rust-lang.org/reference/items/generics.html) |
1631 | struct TypeParamList { | 1631 | struct TypeParamList { |
1632 | T![<], | 1632 | T![<], |
1633 | generic_params: [GenericParam], | ||
1634 | type_params: [TypeParam], | 1633 | type_params: [TypeParam], |
1635 | lifetime_params: [LifetimeParam], | 1634 | lifetime_params: [LifetimeParam], |
1636 | const_params: [ConstParam], | 1635 | const_params: [ConstParam], |
@@ -2102,13 +2101,6 @@ pub(crate) fn rust_ast() -> AstSrc { | |||
2102 | StructDef, EnumDef, UnionDef, | 2101 | StructDef, EnumDef, UnionDef, |
2103 | } | 2102 | } |
2104 | 2103 | ||
2105 | /// Any kind of **declared** generic parameter | ||
2106 | enum GenericParam { | ||
2107 | LifetimeParam, | ||
2108 | TypeParam, | ||
2109 | ConstParam | ||
2110 | } | ||
2111 | |||
2112 | /// Any kind of generic argument passed at instantiation site | 2104 | /// Any kind of generic argument passed at instantiation site |
2113 | enum GenericArg { | 2105 | enum GenericArg { |
2114 | LifetimeArg, | 2106 | LifetimeArg, |