mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Strip
This commit is contained in:
parent
40f9134159
commit
5f48ef3902
2 changed files with 3 additions and 12 deletions
|
@ -4,7 +4,8 @@ use crate::MacroDef;
|
|||
pub enum Namespace {
|
||||
Types,
|
||||
Values,
|
||||
Macro,
|
||||
// Note that only type inference uses this enum, and it doesn't care about macros.
|
||||
// Macro,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -79,14 +80,7 @@ impl<T> PerNs<T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn and_then<U>(self, f: impl Fn(T) -> Option<U>) -> PerNs<U> {
|
||||
PerNs {
|
||||
types: self.types.and_then(&f),
|
||||
values: self.values.and_then(&f),
|
||||
macros: self.macros,
|
||||
}
|
||||
}
|
||||
|
||||
/// Map types and values. Leave macros unchanged.
|
||||
pub fn map<U>(self, f: impl Fn(T) -> U) -> PerNs<U> {
|
||||
PerNs { types: self.types.map(&f), values: self.values.map(&f), macros: self.macros }
|
||||
}
|
||||
|
|
|
@ -429,9 +429,6 @@ pub(crate) fn type_for_def(db: &impl HirDatabase, def: TypableDef, ns: Namespace
|
|||
(TypableDef::Const(_), Namespace::Types) => Ty::Unknown,
|
||||
(TypableDef::Static(_), Namespace::Types) => Ty::Unknown,
|
||||
(TypableDef::BuiltinType(_), Namespace::Values) => Ty::Unknown,
|
||||
|
||||
// Macro is not typeable
|
||||
(_, Namespace::Macro) => Ty::Unknown,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue