diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 64b55860d93..ea06a4a5862 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -59,7 +59,7 @@ fn from(it: $sv) -> $e { ModuleDefId, // FIXME this is exposed and should be used for implementing the `TestImportsLocator` in `ra_assists` only, should be removed later along with the trait and the implementation. }; pub use hir_expand::{ - name::{known, Name}, + name::{name, Name}, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Origin, }; pub use hir_ty::{display::HirDisplay, CallableDef}; diff --git a/crates/ra_hir_expand/src/name.rs b/crates/ra_hir_expand/src/name.rs index 44b47ec91c6..133805bdbb0 100644 --- a/crates/ra_hir_expand/src/name.rs +++ b/crates/ra_hir_expand/src/name.rs @@ -143,9 +143,6 @@ macro_rules! known_names { std, core, alloc, - hash, - fmt, - io, iter, ops, future, @@ -170,9 +167,6 @@ macro_rules! known_names { Neg, Not, Index, - Display, - Iterator, - Hasher, // Builtin macros file, column, @@ -193,6 +187,13 @@ macro_rules! known_names { PartialOrd, Eq, PartialEq, + // FIXME delete those after `ImportResolver` is removed. + hash, + fmt, + io, + Display, + Iterator, + Hasher, ); // self/Self cannot be used as an identifier diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs index fe07959845d..64b04ec2b67 100644 --- a/crates/ra_ide/src/completion/complete_scope.rs +++ b/crates/ra_ide/src/completion/complete_scope.rs @@ -72,62 +72,58 @@ pub(crate) struct ImportResolver { impl ImportResolver { pub(crate) fn new() -> Self { + use hir::name; + let dummy_names = vec![ ( SmolStr::new("fmt"), - ModPath { kind: PathKind::Plain, segments: vec![hir::known::std, hir::known::fmt] }, + ModPath { kind: PathKind::Plain, segments: vec![name![std], name![fmt]] }, ), ( SmolStr::new("io"), - ModPath { kind: PathKind::Plain, segments: vec![hir::known::std, hir::known::io] }, + ModPath { kind: PathKind::Plain, segments: vec![name![std], name![io]] }, ), ( SmolStr::new("iter"), - ModPath { - kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::iter], - }, + ModPath { kind: PathKind::Plain, segments: vec![name![std], name![iter]] }, ), ( SmolStr::new("hash"), - ModPath { - kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::hash], - }, + ModPath { kind: PathKind::Plain, segments: vec![name![std], name![hash]] }, ), ( SmolStr::new("Debug"), ModPath { kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::fmt, hir::known::Debug], + segments: vec![name![std], name![fmt], name![Debug]], }, ), ( SmolStr::new("Display"), ModPath { kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::fmt, hir::known::Display], + segments: vec![name![std], name![fmt], name![Display]], }, ), ( SmolStr::new("Hash"), ModPath { kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::hash, hir::known::Hash], + segments: vec![name![std], name![hash], name![Hash]], }, ), ( SmolStr::new("Hasher"), ModPath { kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::hash, hir::known::Hasher], + segments: vec![name![std], name![hash], name![Hasher]], }, ), ( SmolStr::new("Iterator"), ModPath { kind: PathKind::Plain, - segments: vec![hir::known::std, hir::known::iter, hir::known::Iterator], + segments: vec![name![std], name![iter], name![Iterator]], }, ), ];