Skip to content

Commit

Permalink
clippy::redundant_closure_for_method_calls
Browse files Browse the repository at this point in the history
warning: redundant closure
   --> src/lib.rs:768:38
    |
768 |         self.inner.as_mut().and_then(|c| c.next())
    |                                      ^^^^^^^^^^^^ help: replace the closure with the method itself: `std::iter::Iterator::next`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

warning: redundant closure
   --> src/lib.rs:773:35
    |
773 |             .map_or((0, Some(0)), |ch| ch.size_hint())
    |                                   ^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::iter::Iterator::size_hint`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls

warning: redundant closure
   --> src/lib.rs:779:38
    |
779 |         self.inner.as_mut().and_then(|c| c.next_back())
    |                                      ^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `std::iter::DoubleEndedIterator::next_back`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
  • Loading branch information
jqnatividad committed May 20, 2023
1 parent 073fd76 commit a651ddc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -765,18 +765,18 @@ pub struct Rows<'a, T: CellType> {
impl<'a, T: 'a + CellType> Iterator for Rows<'a, T> {
type Item = &'a [T];
fn next(&mut self) -> Option<Self::Item> {
self.inner.as_mut().and_then(|c| c.next())
self.inner.as_mut().and_then(std::iter::Iterator::next)
}
fn size_hint(&self) -> (usize, Option<usize>) {
self.inner
.as_ref()
.map_or((0, Some(0)), |ch| ch.size_hint())
.map_or((0, Some(0)), std::iter::Iterator::size_hint)
}
}

impl<'a, T: 'a + CellType> DoubleEndedIterator for Rows<'a, T> {
fn next_back(&mut self) -> Option<Self::Item> {
self.inner.as_mut().and_then(|c| c.next_back())
self.inner.as_mut().and_then(std::iter::DoubleEndedIterator::next_back)
}
}

Expand Down

0 comments on commit a651ddc

Please sign in to comment.