diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 11:18:53 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 11:18:53 +0100 |
commit | 683d0a4d93c29c988c40c001a4b574d8f0dcb9c6 (patch) | |
tree | 1d5bb4ce799c6377b49ae73436d50a087db53392 /crates/ra_syntax/src/ast/node_ext.rs | |
parent | 6b7cb8b5ab539fc4333ce34bc29bf77c976f232a (diff) | |
parent | 08ea2271e8050165d0aaf4c994ed3dd746aff3ba (diff) |
Merge #5618
5618: Rename TypeRef -> Type r=matklad a=matklad
The TypeRef name comes from IntelliJ days, where you often have both
type *syntax* as well as *semantical* representation of types in
scope. And naming both Type is confusing.
In rust-analyzer however, we use ast types as `ast::Type`, and have
many more semantic counterparts to ast types, so avoiding name clash
here is just confusing.
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast/node_ext.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/node_ext.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index bba7310ad..30c2db56b 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -82,7 +82,7 @@ impl ast::Attr { | |||
82 | #[derive(Debug, Clone, PartialEq, Eq)] | 82 | #[derive(Debug, Clone, PartialEq, Eq)] |
83 | pub enum PathSegmentKind { | 83 | pub enum PathSegmentKind { |
84 | Name(ast::NameRef), | 84 | Name(ast::NameRef), |
85 | Type { type_ref: Option<ast::TypeRef>, trait_ref: Option<ast::PathType> }, | 85 | Type { type_ref: Option<ast::Type>, trait_ref: Option<ast::PathType> }, |
86 | SelfKw, | 86 | SelfKw, |
87 | SuperKw, | 87 | SuperKw, |
88 | CrateKw, | 88 | CrateKw, |
@@ -108,8 +108,8 @@ impl ast::PathSegment { | |||
108 | // <T> or <T as Trait> | 108 | // <T> or <T as Trait> |
109 | // T is any TypeRef, Trait has to be a PathType | 109 | // T is any TypeRef, Trait has to be a PathType |
110 | let mut type_refs = | 110 | let mut type_refs = |
111 | self.syntax().children().filter(|node| ast::TypeRef::can_cast(node.kind())); | 111 | self.syntax().children().filter(|node| ast::Type::can_cast(node.kind())); |
112 | let type_ref = type_refs.next().and_then(ast::TypeRef::cast); | 112 | let type_ref = type_refs.next().and_then(ast::Type::cast); |
113 | let trait_ref = type_refs.next().and_then(ast::PathType::cast); | 113 | let trait_ref = type_refs.next().and_then(ast::PathType::cast); |
114 | PathSegmentKind::Type { type_ref, trait_ref } | 114 | PathSegmentKind::Type { type_ref, trait_ref } |
115 | } | 115 | } |
@@ -136,21 +136,21 @@ impl ast::UseTreeList { | |||
136 | } | 136 | } |
137 | 137 | ||
138 | impl ast::Impl { | 138 | impl ast::Impl { |
139 | pub fn target_type(&self) -> Option<ast::TypeRef> { | 139 | pub fn target_type(&self) -> Option<ast::Type> { |
140 | match self.target() { | 140 | match self.target() { |
141 | (Some(t), None) | (_, Some(t)) => Some(t), | 141 | (Some(t), None) | (_, Some(t)) => Some(t), |
142 | _ => None, | 142 | _ => None, |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | pub fn target_trait(&self) -> Option<ast::TypeRef> { | 146 | pub fn target_trait(&self) -> Option<ast::Type> { |
147 | match self.target() { | 147 | match self.target() { |
148 | (Some(t), Some(_)) => Some(t), | 148 | (Some(t), Some(_)) => Some(t), |
149 | _ => None, | 149 | _ => None, |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | fn target(&self) -> (Option<ast::TypeRef>, Option<ast::TypeRef>) { | 153 | fn target(&self) -> (Option<ast::Type>, Option<ast::Type>) { |
154 | let mut types = support::children(self.syntax()); | 154 | let mut types = support::children(self.syntax()); |
155 | let first = types.next(); | 155 | let first = types.next(); |
156 | let second = types.next(); | 156 | let second = types.next(); |