Code review fixes

This commit is contained in:
Kirill Bulatov 2020-02-02 14:27:52 +02:00
parent 6dae5cbb11
commit c669b2f489
3 changed files with 19 additions and 22 deletions

View File

@ -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};

View File

@ -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

View File

@ -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]],
},
),
];