Apply clippy suggestions

This commit is contained in:
Clemens Wasser 2021-10-09 20:44:22 +02:00
parent 15491d7b6b
commit 71dd0b928b
22 changed files with 55 additions and 70 deletions

View file

@ -991,8 +991,8 @@ impl<R: Idx, C: Idx> BitMatrix<R, C> {
assert!(row.index() < self.num_rows);
let (start, end) = self.range(row);
let words = &mut self.words[..];
for index in start..end {
words[index] = !0;
for word in words[start..end].iter_mut() {
*word = !0;
}
self.clear_excess_bits(row);
}
@ -1144,7 +1144,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<'a>(&'a self, row: R) -> impl Iterator<Item = C> + 'a {
pub fn iter(&self, row: R) -> impl Iterator<Item = C> + '_ {
self.row(row).into_iter().flat_map(|r| r.iter())
}

View file

@ -634,18 +634,15 @@ impl<I: Idx, T> IndexVec<I, T> {
}
#[inline]
pub fn drain<'a, R: RangeBounds<usize>>(
&'a mut self,
range: R,
) -> impl Iterator<Item = T> + 'a {
pub fn drain<R: RangeBounds<usize>>(&mut self, range: R) -> impl Iterator<Item = T> + '_ {
self.raw.drain(range)
}
#[inline]
pub fn drain_enumerated<'a, R: RangeBounds<usize>>(
&'a mut self,
pub fn drain_enumerated<R: RangeBounds<usize>>(
&mut self,
range: R,
) -> impl Iterator<Item = (I, T)> + 'a {
) -> impl Iterator<Item = (I, T)> + '_ {
self.raw.drain(range).enumerate().map(|(n, t)| (I::new(n), t))
}