Elide more lifetimes

This commit is contained in:
Michael Goulet 2023-12-26 02:12:33 +00:00
parent ae40f6a7ff
commit 4ae024c754
2 changed files with 12 additions and 12 deletions

View File

@ -64,7 +64,7 @@ impl<'p, 'tcx> PatternColumn<'p, 'tcx> {
pcx.ctors_for_ty().split(pcx, column_ctors) pcx.ctors_for_ty().split(pcx, column_ctors)
} }
fn iter<'b>(&'b self) -> impl Iterator<Item = &'p DeconstructedPat<'p, 'tcx>> + Captures<'b> { fn iter(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, 'tcx>> + Captures<'_> {
self.patterns.iter().copied() self.patterns.iter().copied()
} }

View File

@ -851,13 +851,13 @@ impl<'p, Cx: TypeCx> PatStack<'p, Cx> {
self.pats[0] self.pats[0]
} }
fn iter<'b>(&'b self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'b> { fn iter(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'_> {
self.pats.iter().copied() self.pats.iter().copied()
} }
// Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is // Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is
// an or-pattern. Panics if `self` is empty. // an or-pattern. Panics if `self` is empty.
fn expand_or_pat<'b>(&'b self) -> impl Iterator<Item = PatStack<'p, Cx>> + Captures<'b> { fn expand_or_pat(&self) -> impl Iterator<Item = PatStack<'p, Cx>> + Captures<'_> {
self.head().flatten_or_pat().into_iter().map(move |pat| { self.head().flatten_or_pat().into_iter().map(move |pat| {
let mut new = self.clone(); let mut new = self.clone();
new.pats[0] = pat; new.pats[0] = pat;
@ -926,13 +926,13 @@ impl<'p, Cx: TypeCx> MatrixRow<'p, Cx> {
self.pats.head() self.pats.head()
} }
fn iter<'b>(&'b self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'b> { fn iter(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Captures<'_> {
self.pats.iter() self.pats.iter()
} }
// Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is // Recursively expand the first or-pattern into its subpatterns. Only useful if the pattern is
// an or-pattern. Panics if `self` is empty. // an or-pattern. Panics if `self` is empty.
fn expand_or_pat<'b>(&'b self) -> impl Iterator<Item = MatrixRow<'p, Cx>> + Captures<'b> { fn expand_or_pat(&self) -> impl Iterator<Item = MatrixRow<'p, Cx>> + Captures<'_> {
self.pats.expand_or_pat().map(|patstack| MatrixRow { self.pats.expand_or_pat().map(|patstack| MatrixRow {
pats: patstack, pats: patstack,
parent_row: self.parent_row, parent_row: self.parent_row,
@ -1041,21 +1041,21 @@ impl<'p, Cx: TypeCx> Matrix<'p, Cx> {
self.wildcard_row.len() self.wildcard_row.len()
} }
fn rows<'b>( fn rows(
&'b self, &self,
) -> impl Iterator<Item = &'b MatrixRow<'p, Cx>> + Clone + DoubleEndedIterator + ExactSizeIterator ) -> impl Iterator<Item = &MatrixRow<'p, Cx>> + Clone + DoubleEndedIterator + ExactSizeIterator
{ {
self.rows.iter() self.rows.iter()
} }
fn rows_mut<'b>( fn rows_mut(
&'b mut self, &mut self,
) -> impl Iterator<Item = &'b mut MatrixRow<'p, Cx>> + DoubleEndedIterator + ExactSizeIterator ) -> impl Iterator<Item = &mut MatrixRow<'p, Cx>> + DoubleEndedIterator + ExactSizeIterator
{ {
self.rows.iter_mut() self.rows.iter_mut()
} }
/// Iterate over the first pattern of each row. /// Iterate over the first pattern of each row.
fn heads<'b>(&'b self) -> impl Iterator<Item = &'b DeconstructedPat<'p, Cx>> + Clone { fn heads(&self) -> impl Iterator<Item = &'p DeconstructedPat<'p, Cx>> + Clone + Captures<'_> {
self.rows().map(|r| r.head()) self.rows().map(|r| r.head())
} }