mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
internal: get rid of a call to slow O(N) visibility_of function
Instead of inferring module's declared visibility by looking at the scope of its parent, let's just remeber the declared visibility in the DefMap.
This commit is contained in:
parent
c8d19fedb8
commit
6f269708e8
4 changed files with 29 additions and 13 deletions
|
@ -45,11 +45,7 @@ impl Definition {
|
|||
match self {
|
||||
Definition::Field(sf) => Some(sf.visibility(db)),
|
||||
Definition::ModuleDef(def) => match def {
|
||||
ModuleDef::Module(it) => {
|
||||
// FIXME: should work like other cases here.
|
||||
let parent = it.parent(db)?;
|
||||
parent.visibility_of(db, def)
|
||||
}
|
||||
ModuleDef::Module(it) => Some(it.visibility(db)),
|
||||
ModuleDef::Function(it) => Some(it.visibility(db)),
|
||||
ModuleDef::Adt(it) => Some(it.visibility(db)),
|
||||
ModuleDef::Const(it) => Some(it.visibility(db)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue