mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
internal: remove one usage of a slow method
This commit is contained in:
parent
8e0630e728
commit
3c5827cc18
2 changed files with 25 additions and 24 deletions
|
@ -430,12 +430,6 @@ impl Module {
|
|||
.collect()
|
||||
}
|
||||
|
||||
pub fn visibility(self, db: &dyn HirDatabase) -> Visibility {
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
let module_data = &def_map[self.id.local_id];
|
||||
module_data.visibility
|
||||
}
|
||||
|
||||
/// XXX: this O(N) rather O(1) method, avoid using it if you can.
|
||||
pub fn visibility_of(self, db: &dyn HirDatabase, def: &ModuleDef) -> Option<Visibility> {
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
|
@ -647,6 +641,14 @@ impl Module {
|
|||
}
|
||||
}
|
||||
|
||||
impl HasVisibility for Module {
|
||||
fn visibility(&self, db: &dyn HirDatabase) -> Visibility {
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
let module_data = &def_map[self.id.local_id];
|
||||
module_data.visibility
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct Field {
|
||||
pub(crate) parent: VariantDef,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue