Make hir::PathSegment::res
non-optional.
This commit is contained in:
parent
ee244bf196
commit
6d850d936b
20 changed files with 65 additions and 76 deletions
|
@ -957,7 +957,7 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
|
|||
path.segments
|
||||
.iter()
|
||||
.filter_map(move |segment| {
|
||||
let res = segment.res?;
|
||||
let res = segment.res;
|
||||
let generics_def_id = tcx.res_generics_def_id(res)?;
|
||||
let generics = tcx.generics_of(generics_def_id);
|
||||
if generics.has_impl_trait() {
|
||||
|
|
|
@ -154,16 +154,11 @@ impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> {
|
|||
}
|
||||
hir::TyKind::Path(hir::QPath::Resolved(None, path)) => match &path.segments {
|
||||
[segment]
|
||||
if segment
|
||||
.res
|
||||
.map(|res| {
|
||||
matches!(
|
||||
res,
|
||||
Res::SelfTy { trait_: _, alias_to: _ }
|
||||
| Res::Def(hir::def::DefKind::TyParam, _)
|
||||
)
|
||||
})
|
||||
.unwrap_or(false) =>
|
||||
if matches!(
|
||||
segment.res,
|
||||
Res::SelfTy { trait_: _, alias_to: _ }
|
||||
| Res::Def(hir::def::DefKind::TyParam, _)
|
||||
) =>
|
||||
{
|
||||
self.types.push(path.span);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue