rustc_hir: Less error-prone methods for accessing PartialRes
resolution
This commit is contained in:
parent
518263d889
commit
1a8f177772
12 changed files with 75 additions and 90 deletions
|
@ -205,13 +205,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
|||
let static_def_id = self
|
||||
.resolver
|
||||
.get_partial_res(sym.id)
|
||||
.filter(|res| res.unresolved_segments() == 0)
|
||||
.and_then(|res| {
|
||||
if let Res::Def(DefKind::Static(_), def_id) = res.base_res() {
|
||||
Some(def_id)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
.and_then(|res| res.full_res())
|
||||
.and_then(|res| match res {
|
||||
Res::Def(DefKind::Static(_), def_id) => Some(def_id),
|
||||
_ => None,
|
||||
});
|
||||
|
||||
if let Some(def_id) = static_def_id {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue