diff options
author | Aleksey Kladov <[email protected]> | 2018-12-27 17:26:15 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-12-27 17:26:15 +0000 |
commit | a9f55029b9db3bcd439d31c5007785299f7d4025 (patch) | |
tree | 9f6b93060cc56d5c96f4c61d5502b7267a626827 /crates/ra_hir/src/ty.rs | |
parent | d963042ca9da93be8d5922ce46ea26dc6a79c929 (diff) |
introduce known names
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r-- | crates/ra_hir/src/ty.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index dc3323b1a..ad097d1f1 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs | |||
@@ -95,7 +95,7 @@ pub enum Ty { | |||
95 | Tuple(Vec<Ty>), | 95 | Tuple(Vec<Ty>), |
96 | 96 | ||
97 | // The projection of an associated type. For example, | 97 | // The projection of an associated type. For example, |
98 | // `<T as Trait<..>>::N`. | 98 | // `<T as Trait<..>>::N`.pub |
99 | // Projection(ProjectionTy), | 99 | // Projection(ProjectionTy), |
100 | 100 | ||
101 | // Opaque (`impl Trait`) type found in a return type. | 101 | // Opaque (`impl Trait`) type found in a return type. |
@@ -180,12 +180,11 @@ impl Ty { | |||
180 | path: &Path, | 180 | path: &Path, |
181 | ) -> Cancelable<Self> { | 181 | ) -> Cancelable<Self> { |
182 | if let Some(name) = path.as_ident() { | 182 | if let Some(name) = path.as_ident() { |
183 | let name = name.as_str(); // :-( | 183 | if let Some(int_ty) = primitive::IntTy::from_name(name) { |
184 | if let Some(int_ty) = primitive::IntTy::from_string(name) { | ||
185 | return Ok(Ty::Int(int_ty)); | 184 | return Ok(Ty::Int(int_ty)); |
186 | } else if let Some(uint_ty) = primitive::UintTy::from_string(name) { | 185 | } else if let Some(uint_ty) = primitive::UintTy::from_name(name) { |
187 | return Ok(Ty::Uint(uint_ty)); | 186 | return Ok(Ty::Uint(uint_ty)); |
188 | } else if let Some(float_ty) = primitive::FloatTy::from_string(name) { | 187 | } else if let Some(float_ty) = primitive::FloatTy::from_name(name) { |
189 | return Ok(Ty::Float(float_ty)); | 188 | return Ok(Ty::Float(float_ty)); |
190 | } | 189 | } |
191 | } | 190 | } |