Skip to content

Commit

Permalink
chore: address some clippy lints
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii authored and becheran committed Dec 18, 2024
1 parent 07475c9 commit a99760b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ impl<T> Grid<T> {
/// # Panics
///
/// Panics if `rows * cols > usize::MAX` or if `rows * cols * size_of::<T>() > isize::MAX`
#[must_use]
pub fn with_capacity(rows: usize, cols: usize) -> Self {
Self::with_capacity_and_order(rows, cols, Order::default())
}
Expand All @@ -427,6 +428,7 @@ impl<T> Grid<T> {
/// # Panics
///
/// Panics if `rows * cols > usize::MAX` or if `rows * cols * size_of::<T>() > isize::MAX`
#[must_use]
pub fn with_capacity_and_order(rows: usize, cols: usize, order: Order) -> Self {
Self {
data: Vec::with_capacity(rows.checked_mul(cols).unwrap()),
Expand Down Expand Up @@ -634,6 +636,7 @@ impl<T> Grid<T> {
/// assert_eq!(iter.next(), Some(&4));
/// assert_eq!(iter.next(), None);
/// ```
#[allow(clippy::iter_without_into_iter)]
pub fn iter(&self) -> Iter<T> {
self.data.iter()
}
Expand All @@ -650,6 +653,7 @@ impl<T> Grid<T> {
/// assert_eq!(next, Some(&mut 1));
/// *next.unwrap() = 10;
/// ```
#[allow(clippy::iter_without_into_iter)]
pub fn iter_mut(&mut self) -> IterMut<T> {
self.data.iter_mut()
}
Expand Down Expand Up @@ -1731,9 +1735,9 @@ impl<'a, T> Iterator for GridRowIter<'a, T> {
}
}

impl<'a, T> ExactSizeIterator for GridRowIter<'a, T> {}
impl<T> ExactSizeIterator for GridRowIter<'_, T> {}

impl<'a, T> DoubleEndedIterator for GridRowIter<'a, T> {
impl<T> DoubleEndedIterator for GridRowIter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.row_start_index >= self.row_end_index {
return None;
Expand Down Expand Up @@ -1764,9 +1768,9 @@ impl<'a, T> Iterator for GridColIter<'a, T> {
}
}

impl<'a, T> ExactSizeIterator for GridColIter<'a, T> {}
impl<T> ExactSizeIterator for GridColIter<'_, T> {}

impl<'a, T> DoubleEndedIterator for GridColIter<'a, T> {
impl<T> DoubleEndedIterator for GridColIter<'_, T> {
fn next_back(&mut self) -> Option<Self::Item> {
if self.col_start_index >= self.col_end_index {
return None;
Expand Down

0 comments on commit a99760b

Please sign in to comment.