diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-20 18:58:46 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-22 22:24:52 +0000 |
| commit | 12e3911d81034864314503b9c2d9fba2773c7904 (patch) | |
| tree | 3c137d293516116a798effc67b2077dbb2025941 /compiler/rustc_index | |
| parent | 46420c96070b4c4bd8242f16d5806b8f26a57016 (diff) | |
| download | rust-12e3911d81034864314503b9c2d9fba2773c7904.tar.gz rust-12e3911d81034864314503b9c2d9fba2773c7904.zip | |
Greatly simplify lifetime captures in edition 2024
Diffstat (limited to 'compiler/rustc_index')
| -rw-r--r-- | compiler/rustc_index/src/bit_set.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_index/src/interval.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_index/src/slice.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_index/src/vec.rs | 4 |
4 files changed, 7 insertions, 9 deletions
diff --git a/compiler/rustc_index/src/bit_set.rs b/compiler/rustc_index/src/bit_set.rs index d7d90ea16e4..6dc044a6d38 100644 --- a/compiler/rustc_index/src/bit_set.rs +++ b/compiler/rustc_index/src/bit_set.rs @@ -1666,7 +1666,7 @@ impl<R: Idx, C: Idx> SparseBitMatrix<R, C> { /// Iterates through all the columns set to true in a given row of /// the matrix. - pub fn iter(&self, row: R) -> impl Iterator<Item = C> + '_ { + pub fn iter(&self, row: R) -> impl Iterator<Item = C> { self.row(row).into_iter().flat_map(|r| r.iter()) } diff --git a/compiler/rustc_index/src/interval.rs b/compiler/rustc_index/src/interval.rs index a3d87f59567..0225c5c4f32 100644 --- a/compiler/rustc_index/src/interval.rs +++ b/compiler/rustc_index/src/interval.rs @@ -51,7 +51,7 @@ impl<I: Idx> IntervalSet<I> { self.map.clear(); } - pub fn iter(&self) -> impl Iterator<Item = I> + '_ + pub fn iter(&self) -> impl Iterator<Item = I> where I: Step, { @@ -59,7 +59,7 @@ impl<I: Idx> IntervalSet<I> { } /// Iterates through intervals stored in the set, in order. - pub fn iter_intervals(&self) -> impl Iterator<Item = std::ops::Range<I>> + '_ + pub fn iter_intervals(&self) -> impl Iterator<Item = std::ops::Range<I>> where I: Step, { diff --git a/compiler/rustc_index/src/slice.rs b/compiler/rustc_index/src/slice.rs index 956d32c9a69..4636f294f13 100644 --- a/compiler/rustc_index/src/slice.rs +++ b/compiler/rustc_index/src/slice.rs @@ -63,9 +63,7 @@ impl<I: Idx, T> IndexSlice<I, T> { } #[inline] - pub fn iter_enumerated( - &self, - ) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator + '_ { + pub fn iter_enumerated(&self) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator { self.raw.iter().enumerate().map(|(n, t)| (I::new(n), t)) } @@ -84,7 +82,7 @@ impl<I: Idx, T> IndexSlice<I, T> { #[inline] pub fn iter_enumerated_mut( &mut self, - ) -> impl DoubleEndedIterator<Item = (I, &mut T)> + ExactSizeIterator + '_ { + ) -> impl DoubleEndedIterator<Item = (I, &mut T)> + ExactSizeIterator { self.raw.iter_mut().enumerate().map(|(n, t)| (I::new(n), t)) } diff --git a/compiler/rustc_index/src/vec.rs b/compiler/rustc_index/src/vec.rs index 1cb8bc861af..7f3f3ead5f2 100644 --- a/compiler/rustc_index/src/vec.rs +++ b/compiler/rustc_index/src/vec.rs @@ -132,7 +132,7 @@ impl<I: Idx, T> IndexVec<I, T> { } #[inline] - pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> impl Iterator<Item = T> + '_ { + pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> impl Iterator<Item = T> { self.raw.drain(range) } @@ -140,7 +140,7 @@ impl<I: Idx, T> IndexVec<I, T> { pub fn drain_enumerated<R: RangeBounds<usize>>( &mut self, range: R, - ) -> impl Iterator<Item = (I, T)> + '_ { + ) -> impl Iterator<Item = (I, T)> { let begin = match range.start_bound() { std::ops::Bound::Included(i) => *i, std::ops::Bound::Excluded(i) => i.checked_add(1).unwrap(), |
