Skip to content

Commit d071ce1

Browse files
committed
Overhaul RegionKind and Region.
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
1 parent 5fa961b commit d071ce1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_lints/src/methods/expect_fun_call.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ pub(super) fn check<'tcx>(
7373
match cx.qpath_res(p, fun.hir_id) {
7474
hir::def::Res::Def(hir::def::DefKind::Fn | hir::def::DefKind::AssocFn, def_id) => matches!(
7575
cx.tcx.fn_sig(def_id).output().skip_binder().kind(),
76-
ty::Ref(ty::ReStatic, ..)
76+
ty::Ref(re, ..) if re.is_static(),
7777
),
7878
_ => false,
7979
}
@@ -87,7 +87,7 @@ pub(super) fn check<'tcx>(
8787
.map_or(false, |method_id| {
8888
matches!(
8989
cx.tcx.fn_sig(method_id).output().skip_binder().kind(),
90-
ty::Ref(ty::ReStatic, ..)
90+
ty::Ref(re, ..) if re.is_static()
9191
)
9292
})
9393
},

0 commit comments

Comments
 (0)