From 259c42f00e2e85594c7373166bc8467ce375a045 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 13 Dec 2019 21:43:53 +0100 Subject: Add macros for known names and paths --- crates/ra_hir/src/code_model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index c705d1630..d1153fa62 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -17,7 +17,7 @@ use hir_def::{ }; use hir_expand::{ diagnostics::DiagnosticSink, - name::{self, AsName}, + name::{AsName, N}, MacroDefId, }; use hir_ty::{ @@ -723,7 +723,7 @@ impl Local { } pub fn is_self(self, db: &impl HirDatabase) -> bool { - self.name(db) == Some(name::SELF_PARAM) + self.name(db) == Some(N![self]) } pub fn is_mut(self, db: &impl HirDatabase) -> bool { -- cgit v1.2.3 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/src/code_model.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index d1153fa62..7850ea9a7 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs @@ -17,7 +17,7 @@ use hir_def::{ }; use hir_expand::{ diagnostics::DiagnosticSink, - name::{AsName, N}, + name::{name, AsName}, MacroDefId, }; use hir_ty::{ @@ -723,7 +723,7 @@ impl Local { } pub fn is_self(self, db: &impl HirDatabase) -> bool { - self.name(db) == Some(N![self]) + self.name(db) == Some(name![self]) } pub fn is_mut(self, db: &impl HirDatabase) -> bool { -- cgit v1.2.3 From f02fcc16444fcd18ccd51b43fa01bf0233e044fa Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Fri, 13 Dec 2019 22:32:44 +0100 Subject: Use path macro --- crates/ra_hir/src/source_binder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index d3cc5c423..f82242c3a 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -15,7 +15,7 @@ use hir_def::{ }, expr::{ExprId, PatId}, nameres::ModuleSource, - path::known, + path::path, resolver::{self, resolver_for_scope, HasResolver, Resolver, TypeNs, ValueNs}, AssocItemId, DefWithBodyId, }; @@ -418,7 +418,7 @@ impl SourceAnalyzer { /// Checks that particular type `ty` implements `std::future::Future`. /// This function is used in `.await` syntax completion. pub fn impls_future(&self, db: &impl HirDatabase, ty: Type) -> bool { - let std_future_path = known::std_future_future(); + let std_future_path = path![std::future::Future]; let std_future_trait = match self.resolver.resolve_known_trait(db, &std_future_path) { Some(it) => it.into(), -- cgit v1.2.3