From d963042ca9da93be8d5922ce46ea26dc6a79c929 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Dec 2018 20:07:21 +0300 Subject: introduce hir::Name --- crates/ra_hir/src/ty.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir/src/ty.rs') diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index 67b523c2c..dc3323b1a 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -179,13 +179,13 @@ impl Ty { module: &Module, path: &Path, ) -> Cancelable { - if path.is_ident() { - let name = &path.segments[0]; - if let Some(int_ty) = primitive::IntTy::from_string(&name) { + if let Some(name) = path.as_ident() { + let name = name.as_str(); // :-( + if let Some(int_ty) = primitive::IntTy::from_string(name) { return Ok(Ty::Int(int_ty)); - } else if let Some(uint_ty) = primitive::UintTy::from_string(&name) { + } else if let Some(uint_ty) = primitive::UintTy::from_string(name) { return Ok(Ty::Uint(uint_ty)); - } else if let Some(float_ty) = primitive::FloatTy::from_string(&name) { + } else if let Some(float_ty) = primitive::FloatTy::from_string(name) { return Ok(Ty::Float(float_ty)); } } -- cgit v1.2.3