mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Refactor the import location
This commit is contained in:
parent
89d410cef5
commit
e74c55bb4a
3 changed files with 129 additions and 165 deletions
|
@ -1115,6 +1115,7 @@ pub enum AssocItem {
|
|||
Const(Const),
|
||||
TypeAlias(TypeAlias),
|
||||
}
|
||||
#[derive(Debug)]
|
||||
pub enum AssocItemContainer {
|
||||
Trait(Trait),
|
||||
Impl(Impl),
|
||||
|
@ -2148,6 +2149,16 @@ impl ScopeDef {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ItemInNs> for ScopeDef {
|
||||
fn from(item: ItemInNs) -> Self {
|
||||
match item {
|
||||
ItemInNs::Types(id) => ScopeDef::ModuleDef(id.into()),
|
||||
ItemInNs::Values(id) => ScopeDef::ModuleDef(id.into()),
|
||||
ItemInNs::Macros(id) => ScopeDef::MacroDef(id.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub trait HasVisibility {
|
||||
fn visibility(&self, db: &dyn HirDatabase) -> Visibility;
|
||||
fn is_visible_from(&self, db: &dyn HirDatabase, module: Module) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue