mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Code review fixes
This commit is contained in:
parent
6dae5cbb11
commit
c669b2f489
3 changed files with 19 additions and 22 deletions
|
@ -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};
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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]],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue