From d3ce69aee3297e683691ec0123f5a2584a8075a0 Mon Sep 17 00:00:00 2001 From: Ville Penttinen Date: Wed, 27 Feb 2019 14:00:08 +0200 Subject: Remove `TypeRef` from item opts which implement TypeAscriptionOwner --- crates/ra_hir/src/adt.rs | 4 ++-- crates/ra_hir/src/code_model_impl/function.rs | 6 +++--- crates/ra_hir/src/expr.rs | 6 +++--- crates/ra_hir/src/type_ref.rs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index 6d917bb1b..325f1d7b6 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use ra_arena::{RawId, Arena, impl_arena_id}; use ra_syntax::{ TreeArc, - ast::{self, NameOwner, StructFlavor} + ast::{self, NameOwner, StructFlavor, TypeAscriptionOwner} }; use crate::{ @@ -164,7 +164,7 @@ impl VariantData { .fields() .map(|fd| StructFieldData { name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), - type_ref: TypeRef::from_ast_opt(fd.type_ref()), + type_ref: TypeRef::from_ast_opt(fd.ascribed_type()), }) .collect(); VariantDataInner::Struct(fields) diff --git a/crates/ra_hir/src/code_model_impl/function.rs b/crates/ra_hir/src/code_model_impl/function.rs index c401528c6..c1654b069 100644 --- a/crates/ra_hir/src/code_model_impl/function.rs +++ b/crates/ra_hir/src/code_model_impl/function.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use ra_syntax::ast::{self, NameOwner}; +use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; use crate::{ Name, AsName, Function, FnSignature, @@ -19,7 +19,7 @@ impl FnSignature { let mut has_self_param = false; if let Some(param_list) = node.param_list() { if let Some(self_param) = param_list.self_param() { - let self_type = if let Some(type_ref) = self_param.type_ref() { + let self_type = if let Some(type_ref) = self_param.ascribed_type() { TypeRef::from_ast(type_ref) } else { let self_type = TypeRef::Path(Name::self_type().into()); @@ -37,7 +37,7 @@ impl FnSignature { has_self_param = true; } for param in param_list.params() { - let type_ref = TypeRef::from_ast_opt(param.type_ref()); + let type_ref = TypeRef::from_ast_opt(param.ascribed_type()); params.push(type_ref); } } diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index e9db8282f..aa39d28ed 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -6,7 +6,7 @@ use rustc_hash::FxHashMap; use ra_arena::{Arena, RawId, impl_arena_id, map::ArenaMap}; use ra_syntax::{ SyntaxNodePtr, AstNode, - ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor} + ast::{self, LoopBodyOwner, ArgListOwner, NameOwner, LiteralFlavor, TypeAscriptionOwner} }; use crate::{ @@ -709,7 +709,7 @@ impl ExprCollector { if let Some(pl) = e.param_list() { for param in pl.params() { let pat = self.collect_pat_opt(param.pat()); - let type_ref = param.type_ref().map(TypeRef::from_ast); + let type_ref = param.ascribed_type().map(TypeRef::from_ast); args.push(pat); arg_types.push(type_ref); } @@ -790,7 +790,7 @@ impl ExprCollector { .map(|s| match s.kind() { ast::StmtKind::LetStmt(stmt) => { let pat = self.collect_pat_opt(stmt.pat()); - let type_ref = stmt.type_ref().map(TypeRef::from_ast); + let type_ref = stmt.ascribed_type().map(TypeRef::from_ast); let initializer = stmt.initializer().map(|e| self.collect_expr(e)); Statement::Let { pat, type_ref, initializer } } diff --git a/crates/ra_hir/src/type_ref.rs b/crates/ra_hir/src/type_ref.rs index ee8b7376a..8aa807648 100644 --- a/crates/ra_hir/src/type_ref.rs +++ b/crates/ra_hir/src/type_ref.rs @@ -1,7 +1,7 @@ //! HIR for references to types. Paths in these are not yet resolved. They can //! be directly created from an ast::TypeRef, without further queries. -use ra_syntax::ast; +use ra_syntax::ast::{self, TypeAscriptionOwner}; use crate::Path; @@ -81,7 +81,7 @@ impl TypeRef { FnPointerType(inner) => { let ret_ty = TypeRef::from_ast_opt(inner.ret_type().and_then(|rt| rt.type_ref())); let mut params = if let Some(pl) = inner.param_list() { - pl.params().map(|p| p.type_ref()).map(TypeRef::from_ast_opt).collect() + pl.params().map(|p| p.ascribed_type()).map(TypeRef::from_ast_opt).collect() } else { Vec::new() }; -- cgit v1.2.3