mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Make flyimport respect #[doc(hidden)]
This commit is contained in:
parent
16f3e2bf6e
commit
8764cc955f
3 changed files with 66 additions and 0 deletions
|
@ -1599,6 +1599,21 @@ impl ItemInNs {
|
|||
ItemInNs::Macros(_) => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the crate defining this item (or `None` if `self` is built-in).
|
||||
pub fn krate(&self, db: &dyn HirDatabase) -> Option<Crate> {
|
||||
match self {
|
||||
ItemInNs::Types(did) | ItemInNs::Values(did) => did.module(db).map(|m| m.krate()),
|
||||
ItemInNs::Macros(id) => id.module(db).map(|m| m.krate()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn attrs(&self, db: &dyn HirDatabase) -> Option<AttrsWithOwner> {
|
||||
match self {
|
||||
ItemInNs::Types(it) | ItemInNs::Values(it) => it.attrs(db),
|
||||
ItemInNs::Macros(it) => Some(it.attrs(db)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Invariant: `inner.as_assoc_item(db).is_some()`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue