Add unreachable code rule (#5384)

Co-authored-by: Thomas de Zeeuw <thomas@astral.sh>
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
Thomas de Zeeuw 2023-07-04 16:27:23 +02:00 committed by GitHub
parent 937de121f3
commit 0b963ddcfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 4688 additions and 4 deletions

View file

@ -40,6 +40,11 @@ impl<I: Idx, T> IndexSlice<I, T> {
}
}
#[inline]
pub const fn first(&self) -> Option<&T> {
self.raw.first()
}
#[inline]
pub const fn len(&self) -> usize {
self.raw.len()
@ -63,6 +68,13 @@ impl<I: Idx, T> IndexSlice<I, T> {
(0..self.len()).map(|n| I::new(n))
}
#[inline]
pub fn iter_enumerated(
&self,
) -> impl DoubleEndedIterator<Item = (I, &T)> + ExactSizeIterator + '_ {
self.raw.iter().enumerate().map(|(n, t)| (I::new(n), t))
}
#[inline]
pub fn iter_mut(&mut self) -> std::slice::IterMut<'_, T> {
self.raw.iter_mut()