Skip to content

Commit ae40f6a

Browse files
Clean up more lifetimes
1 parent b91a98b commit ae40f6a

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

compiler/rustc_pattern_analysis/src/constructor.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -861,12 +861,9 @@ impl<Cx: TypeCx> ConstructorSet<Cx> {
861861
#[instrument(level = "debug", skip(self, pcx, ctors), ret)]
862862
pub(crate) fn split<'a>(
863863
&self,
864-
pcx: &PlaceCtxt<'_, '_, Cx>,
864+
pcx: &PlaceCtxt<'a, '_, Cx>,
865865
ctors: impl Iterator<Item = &'a Constructor<Cx>> + Clone,
866-
) -> SplitConstructorSet<Cx>
867-
where
868-
Cx: 'a,
869-
{
866+
) -> SplitConstructorSet<Cx> {
870867
let mut present: SmallVec<[_; 1]> = SmallVec::new();
871868
// Empty constructors found missing.
872869
let mut missing_empty = Vec::new();

compiler/rustc_pattern_analysis/src/pat.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,15 @@ impl<'p, Cx: TypeCx> DeconstructedPat<'p, Cx> {
7171
self.data.as_ref()
7272
}
7373

74-
pub fn iter_fields<'a>(
75-
&'a self,
76-
) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'a> {
74+
pub fn iter_fields(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'_> {
7775
self.fields.iter()
7876
}
7977

8078
/// Specialize this pattern with a constructor.
8179
/// `other_ctor` can be different from `self.ctor`, but must be covered by it.
82-
pub(crate) fn specialize<'a>(
80+
pub(crate) fn specialize(
8381
&self,
84-
pcx: &PlaceCtxt<'a, 'p, Cx>,
82+
pcx: &PlaceCtxt<'_, 'p, Cx>,
8583
other_ctor: &Constructor<Cx>,
8684
) -> SmallVec<[&'p DeconstructedPat<'p, Cx>; 2]> {
8785
let wildcard_sub_tys = || {
@@ -196,7 +194,7 @@ impl<Cx: TypeCx> WitnessPat<Cx> {
196194
self.ty
197195
}
198196

199-
pub fn iter_fields<'a>(&'a self) -> impl Iterator<Item = &'a WitnessPat<Cx>> {
197+
pub fn iter_fields(&self) -> impl Iterator<Item = &WitnessPat<Cx>> {
200198
self.fields.iter()
201199
}
202200
}

compiler/rustc_pattern_analysis/src/rustc.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
128128
// In the cases of either a `#[non_exhaustive]` field list or a non-public field, we hide
129129
// uninhabited fields in order not to reveal the uninhabitedness of the whole variant.
130130
// This lists the fields we keep along with their types.
131-
pub(crate) fn list_variant_nonhidden_fields<'a>(
132-
&'a self,
131+
pub(crate) fn list_variant_nonhidden_fields(
132+
&self,
133133
ty: Ty<'tcx>,
134-
variant: &'a VariantDef, // TODO:
135-
) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'a> {
134+
variant: &'tcx VariantDef,
135+
) -> impl Iterator<Item = (FieldIdx, Ty<'tcx>)> + Captures<'p> + Captures<'_> {
136136
let cx = self;
137137
let ty::Adt(adt, args) = ty.kind() else { bug!() };
138138
// Whether we must not match the fields of this variant exhaustively.

0 commit comments

Comments
 (0)