From 6911bc89a784ce72b4dfd8e0ba72bd22ce898395 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 13 Dec 2019 22:01:06 +0100 Subject: Rename N! to name! --- crates/ra_hir_def/src/body/lower.rs | 4 +-- crates/ra_hir_def/src/builtin_type.rs | 42 +++++++++++++++--------------- crates/ra_hir_def/src/data.rs | 4 +-- crates/ra_hir_def/src/generics.rs | 6 ++--- crates/ra_hir_def/src/nameres/collector.rs | 4 +-- crates/ra_hir_def/src/path.rs | 8 +++--- crates/ra_hir_def/src/resolver.rs | 16 ++++++------ 7 files changed, 42 insertions(+), 42 deletions(-) (limited to 'crates/ra_hir_def') diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 6c760166f..61193b4d8 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -2,7 +2,7 @@ //! representation. use either::Either; -use hir_expand::name::{AsName, Name, N}; +use hir_expand::name::{name, AsName, Name}; use ra_arena::Arena; use ra_syntax::{ ast::{ @@ -68,7 +68,7 @@ where let ptr = AstPtr::new(&self_param); let param_pat = self.alloc_pat( Pat::Bind { - name: N![self], + name: name![self], mode: BindingAnnotation::Unannotated, subpat: None, }, diff --git a/crates/ra_hir_def/src/builtin_type.rs b/crates/ra_hir_def/src/builtin_type.rs index 757123f82..d14901a9b 100644 --- a/crates/ra_hir_def/src/builtin_type.rs +++ b/crates/ra_hir_def/src/builtin_type.rs @@ -5,7 +5,7 @@ use std::fmt; -use hir_expand::name::{Name, N}; +use hir_expand::name::{name, Name}; #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum Signedness { @@ -52,26 +52,26 @@ pub enum BuiltinType { impl BuiltinType { #[rustfmt::skip] pub const ALL: &'static [(Name, BuiltinType)] = &[ - (N![char], BuiltinType::Char), - (N![bool], BuiltinType::Bool), - (N![str], BuiltinType::Str), - - (N![isize], BuiltinType::Int(BuiltinInt::ISIZE)), - (N![i8], BuiltinType::Int(BuiltinInt::I8)), - (N![i16], BuiltinType::Int(BuiltinInt::I16)), - (N![i32], BuiltinType::Int(BuiltinInt::I32)), - (N![i64], BuiltinType::Int(BuiltinInt::I64)), - (N![i128], BuiltinType::Int(BuiltinInt::I128)), - - (N![usize], BuiltinType::Int(BuiltinInt::USIZE)), - (N![u8], BuiltinType::Int(BuiltinInt::U8)), - (N![u16], BuiltinType::Int(BuiltinInt::U16)), - (N![u32], BuiltinType::Int(BuiltinInt::U32)), - (N![u64], BuiltinType::Int(BuiltinInt::U64)), - (N![u128], BuiltinType::Int(BuiltinInt::U128)), - - (N![f32], BuiltinType::Float(BuiltinFloat::F32)), - (N![f64], BuiltinType::Float(BuiltinFloat::F64)), + (name![char], BuiltinType::Char), + (name![bool], BuiltinType::Bool), + (name![str], BuiltinType::Str), + + (name![isize], BuiltinType::Int(BuiltinInt::ISIZE)), + (name![i8], BuiltinType::Int(BuiltinInt::I8)), + (name![i16], BuiltinType::Int(BuiltinInt::I16)), + (name![i32], BuiltinType::Int(BuiltinInt::I32)), + (name![i64], BuiltinType::Int(BuiltinInt::I64)), + (name![i128], BuiltinType::Int(BuiltinInt::I128)), + + (name![usize], BuiltinType::Int(BuiltinInt::USIZE)), + (name![u8], BuiltinType::Int(BuiltinInt::U8)), + (name![u16], BuiltinType::Int(BuiltinInt::U16)), + (name![u32], BuiltinType::Int(BuiltinInt::U32)), + (name![u64], BuiltinType::Int(BuiltinInt::U64)), + (name![u128], BuiltinType::Int(BuiltinInt::U128)), + + (name![f32], BuiltinType::Float(BuiltinFloat::F32)), + (name![f64], BuiltinType::Float(BuiltinFloat::F64)), ]; } diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index afeac0ec2..4f4ef57cc 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs @@ -3,7 +3,7 @@ use std::sync::Arc; use hir_expand::{ - name::{AsName, Name, N}, + name::{name, AsName, Name}, AstId, }; use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; @@ -37,7 +37,7 @@ impl FunctionData { let self_type = if let Some(type_ref) = self_param.ascribed_type() { TypeRef::from_ast(type_ref) } else { - let self_type = TypeRef::Path(N![Self].into()); + let self_type = TypeRef::Path(name![Self].into()); match self_param.kind() { ast::SelfParamKind::Owned => self_type, ast::SelfParamKind::Ref => { diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index 2b13748f3..e9c28c730 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use either::Either; use hir_expand::{ - name::{AsName, Name, N}, + name::{name, AsName, Name}, InFile, }; use ra_arena::{map::ArenaMap, Arena}; @@ -90,11 +90,11 @@ impl GenericParams { // traits get the Self type as an implicit first type parameter let self_param_id = - generics.types.alloc(TypeParamData { name: N![Self], default: None }); + generics.types.alloc(TypeParamData { name: name![Self], default: None }); sm.insert(self_param_id, Either::Left(src.value.clone())); // add super traits as bounds on Self // i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar - let self_param = TypeRef::Path(N![Self].into()); + let self_param = TypeRef::Path(name![Self].into()); generics.fill_bounds(&src.value, self_param); generics.fill(&mut sm, &src.value); diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index e81bac914..5d7469a6e 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs @@ -6,7 +6,7 @@ use hir_expand::{ builtin_derive::find_builtin_derive, builtin_macro::find_builtin_macro, - name::{AsName, Name, N}, + name::{name, AsName, Name}, HirFileId, MacroCallId, MacroCallKind, MacroDefId, MacroDefKind, }; use ra_cfg::CfgOptions; @@ -918,7 +918,7 @@ where } fn is_macro_rules(path: &Path) -> bool { - path.as_ident() == Some(&N![macro_rules]) + path.as_ident() == Some(&name![macro_rules]) } #[cfg(test)] diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 36ad27867..c1376af36 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs @@ -6,7 +6,7 @@ use std::{iter, sync::Arc}; use either::Either; use hir_expand::{ hygiene::Hygiene, - name::{AsName, Name, N}, + name::{name, AsName, Name}, }; use ra_db::CrateId; use ra_syntax::{ @@ -276,7 +276,7 @@ impl GenericArgs { } if let Some(ret_type) = ret_type { let type_ref = TypeRef::from_ast_opt(ret_type.type_ref()); - bindings.push((N![Output], type_ref)) + bindings.push((name![Output], type_ref)) } if args.is_empty() && bindings.is_empty() { None @@ -297,12 +297,12 @@ impl From for Path { } pub mod known { - use hir_expand::name::N; + use hir_expand::name::name; use super::{Path, PathKind}; macro_rules! P { - ($start:ident $(:: $seg:ident)*) => { Path::from_simple_segments(PathKind::Abs, vec![N![$start], $(N![$seg],)*]) }; + ($start:ident $(:: $seg:ident)*) => { Path::from_simple_segments(PathKind::Abs, vec![name![$start], $(name![$seg],)*]) }; } pub fn std_iter_into_iterator() -> Path { diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 0fb529527..b6d595a20 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use hir_expand::{ - name::{Name, N}, + name::{name, Name}, MacroDefId, }; use ra_db::CrateId; @@ -163,13 +163,13 @@ impl Resolver { } } Scope::ImplBlockScope(impl_) => { - if first_name == &N![Self] { + if first_name == &name![Self] { let idx = if path.segments.len() == 1 { None } else { Some(1) }; return Some((TypeNs::SelfType(*impl_), idx)); } } Scope::AdtScope(adt) => { - if first_name == &N![Self] { + if first_name == &name![Self] { let idx = if path.segments.len() == 1 { None } else { Some(1) }; return Some((TypeNs::AdtSelfType(*adt), idx)); } @@ -223,7 +223,7 @@ impl Resolver { return None; } let n_segments = path.segments.len(); - let tmp = N![self]; + let tmp = name![self]; let first_name = if path.is_self() { &tmp } else { &path.segments.first()?.name }; let skip_to_mod = path.kind != PathKind::Plain && !path.is_self(); for scope in self.scopes.iter().rev() { @@ -259,13 +259,13 @@ impl Resolver { Scope::GenericParams { .. } => continue, Scope::ImplBlockScope(impl_) if n_segments > 1 => { - if first_name == &N![Self] { + if first_name == &name![Self] { let ty = TypeNs::SelfType(*impl_); return Some(ResolveValueResult::Partial(ty, 1)); } } Scope::AdtScope(adt) if n_segments > 1 => { - if first_name == &N![Self] { + if first_name == &name![Self] { let ty = TypeNs::AdtSelfType(*adt); return Some(ResolveValueResult::Partial(ty, 1)); } @@ -439,10 +439,10 @@ impl Scope { } } Scope::ImplBlockScope(i) => { - f(N![Self], ScopeDef::ImplSelfType((*i).into())); + f(name![Self], ScopeDef::ImplSelfType((*i).into())); } Scope::AdtScope(i) => { - f(N![Self], ScopeDef::AdtSelfType((*i).into())); + f(name![Self], ScopeDef::AdtSelfType((*i).into())); } Scope::ExprScope(scope) => { scope.expr_scopes.entries(scope.scope_id).iter().for_each(|e| { -- cgit v1.2.3