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 @@ pub use hir_def::{
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. 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::{ pub use hir_expand::{
name::{known, Name}, name::{name, Name},
HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Origin, HirFileId, InFile, MacroCallId, MacroCallLoc, MacroDefId, MacroFile, Origin,
}; };
pub use hir_ty::{display::HirDisplay, CallableDef}; pub use hir_ty::{display::HirDisplay, CallableDef};

View file

@ -143,9 +143,6 @@ pub mod known {
std, std,
core, core,
alloc, alloc,
hash,
fmt,
io,
iter, iter,
ops, ops,
future, future,
@ -170,9 +167,6 @@ pub mod known {
Neg, Neg,
Not, Not,
Index, Index,
Display,
Iterator,
Hasher,
// Builtin macros // Builtin macros
file, file,
column, column,
@ -193,6 +187,13 @@ pub mod known {
PartialOrd, PartialOrd,
Eq, Eq,
PartialEq, PartialEq,
// FIXME delete those after `ImportResolver` is removed.
hash,
fmt,
io,
Display,
Iterator,
Hasher,
); );
// self/Self cannot be used as an identifier // self/Self cannot be used as an identifier

View file

@ -72,62 +72,58 @@ pub(crate) struct ImportResolver {
impl ImportResolver { impl ImportResolver {
pub(crate) fn new() -> Self { pub(crate) fn new() -> Self {
use hir::name;
let dummy_names = vec![ let dummy_names = vec![
( (
SmolStr::new("fmt"), 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"), 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"), SmolStr::new("iter"),
ModPath { ModPath { kind: PathKind::Plain, segments: vec![name![std], name![iter]] },
kind: PathKind::Plain,
segments: vec![hir::known::std, hir::known::iter],
},
), ),
( (
SmolStr::new("hash"), SmolStr::new("hash"),
ModPath { ModPath { kind: PathKind::Plain, segments: vec![name![std], name![hash]] },
kind: PathKind::Plain,
segments: vec![hir::known::std, hir::known::hash],
},
), ),
( (
SmolStr::new("Debug"), SmolStr::new("Debug"),
ModPath { ModPath {
kind: PathKind::Plain, 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"), SmolStr::new("Display"),
ModPath { ModPath {
kind: PathKind::Plain, 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"), SmolStr::new("Hash"),
ModPath { ModPath {
kind: PathKind::Plain, 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"), SmolStr::new("Hasher"),
ModPath { ModPath {
kind: PathKind::Plain, 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"), SmolStr::new("Iterator"),
ModPath { ModPath {
kind: PathKind::Plain, kind: PathKind::Plain,
segments: vec![hir::known::std, hir::known::iter, hir::known::Iterator], segments: vec![name![std], name![iter], name![Iterator]],
}, },
), ),
]; ];