mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Use more generic public api
This commit is contained in:
parent
d5e11b33a3
commit
944f28fe5b
9 changed files with 58 additions and 47 deletions
|
@ -143,17 +143,6 @@ impl ModuleDef {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<ModuleDef> for ItemInNs {
|
||||
fn from(module_def: ModuleDef) -> Self {
|
||||
match module_def {
|
||||
ModuleDef::Static(_) | ModuleDef::Const(_) | ModuleDef::Function(_) => {
|
||||
ItemInNs::Values(module_def.into())
|
||||
}
|
||||
_ => ItemInNs::Types(module_def.into()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use hir_def::{
|
||||
attr::Attrs, item_scope::ItemInNs, visibility::Visibility, AssocItemId, AssocItemLoc,
|
||||
};
|
||||
|
@ -290,9 +279,9 @@ impl Module {
|
|||
pub fn find_use_path(
|
||||
self,
|
||||
db: &dyn DefDatabase,
|
||||
item: ItemInNs,
|
||||
item: impl Into<ItemInNs>,
|
||||
) -> Option<hir_def::path::ModPath> {
|
||||
hir_def::find_path::find_path(db, item, self.into())
|
||||
hir_def::find_path::find_path(db, item.into(), self.into())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,12 +753,6 @@ impl MacroDef {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<MacroDef> for ItemInNs {
|
||||
fn from(macro_def: MacroDef) -> Self {
|
||||
ItemInNs::Macros(macro_def.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Invariant: `inner.as_assoc_item(db).is_some()`
|
||||
/// We do not actively enforce this invariant.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue