mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-15 22:54:00 +00:00
Slightly optimize Resolver::krate
This commit is contained in:
parent
4b4a34327e
commit
17691ee974
1 changed files with 7 additions and 1 deletions
|
@ -448,7 +448,13 @@ impl Resolver {
|
|||
}
|
||||
|
||||
pub fn krate(&self) -> CrateId {
|
||||
self.module_scope().0.krate()
|
||||
self.scopes
|
||||
.get(0)
|
||||
.and_then(|scope| match scope {
|
||||
Scope::ModuleScope(m) => Some(m.def_map.krate()),
|
||||
_ => None,
|
||||
})
|
||||
.expect("module scope invariant violated")
|
||||
}
|
||||
|
||||
pub fn where_predicates_in_scope(
|
||||
|
|
Loading…
Reference in a new issue