Skip to content

Commit

Permalink
Fix latest clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
rossmacarthur committed Dec 8, 2024
1 parent 09cb5c6 commit 0fd1147
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crates/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository.workspace = true
license.workspace = true

[lib]
proc_macro = true
proc-macro = true

[dependencies]
proc-macro2 = "1.0"
Expand Down
12 changes: 6 additions & 6 deletions crates/stride/src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ impl<'a, T, const S: usize> Iterator for Iter<'a, T, S> {
}
}

impl<'a, T, const S: usize> DoubleEndedIterator for Iter<'a, T, S> {
impl<T, const S: usize> DoubleEndedIterator for Iter<'_, T, S> {
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back()
}
}

impl<'a, T, const S: usize> ExactSizeIterator for Iter<'a, T, S> {
impl<T, const S: usize> ExactSizeIterator for Iter<'_, T, S> {
fn len(&self) -> usize {
self.iter.len()
}
}

impl<'a, T, const S: usize> FusedIterator for Iter<'a, T, S> {}
impl<T, const S: usize> FusedIterator for Iter<'_, T, S> {}

impl<'a, T, const S: usize> IntoIterator for &'a Stride<T, S> {
type Item = &'a T;
Expand Down Expand Up @@ -110,19 +110,19 @@ impl<'a, T, const S: usize> Iterator for IterMut<'a, T, S> {
}
}

impl<'a, T, const S: usize> DoubleEndedIterator for IterMut<'a, T, S> {
impl<T, const S: usize> DoubleEndedIterator for IterMut<'_, T, S> {
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back()
}
}

impl<'a, T, const S: usize> ExactSizeIterator for IterMut<'a, T, S> {
impl<T, const S: usize> ExactSizeIterator for IterMut<'_, T, S> {
fn len(&self) -> usize {
self.iter.len()
}
}

impl<'a, T, const S: usize> FusedIterator for IterMut<'a, T, S> {}
impl<T, const S: usize> FusedIterator for IterMut<'_, T, S> {}

impl<'a, T, const S: usize> IntoIterator for &'a mut Stride<T, S> {
type Item = &'a mut T;
Expand Down
2 changes: 1 addition & 1 deletion crates/stride/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<T, const S: usize> Stride<T, S> {
/// assert_eq!(Stride::<_, 3>::new(data).len(), 2);
/// ```
pub const fn len(&self) -> usize {
(self.data.len() + S - 1) / S
self.data.len().div_ceil(S)
}

/// Returns `true` if the strided slice has a length of 0.
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ impl<T, const M: usize, const N: usize> Matrix<T, M, N> {
/// let column_vector = matrix![1; 2; 3];
/// assert_eq!(column_vector.l1_norm(), 6);
/// ```
#[doc(alias("manhattan", "taxicab"))]
pub fn l1_norm(&self) -> T
where
T: Copy + Ord + Abs + Zero + Sum<T>,
Expand Down
12 changes: 6 additions & 6 deletions tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ fn matrix_into_iter_fuse() {
let m = matrix![1, 3, 3, 7];
let mut iter = m.into_iter();
for _ in 0..4 {
assert!(matches!(iter.next(), Some(_)));
assert!(iter.next().is_some());
}
for _ in 0..10 {
assert!(matches!(iter.next(), None));
assert!(iter.next().is_none());
}
}

Expand Down Expand Up @@ -103,10 +103,10 @@ fn matrix_iter_rows_fuse() {
let m = matrix![1; 3; 3; 7];
let mut iter = m.iter_rows();
for _ in 0..4 {
assert!(matches!(iter.next(), Some(_)));
assert!(iter.next().is_some());
}
for _ in 0..10 {
assert!(matches!(iter.next(), None));
assert!(iter.next().is_none());
}
}

Expand All @@ -115,10 +115,10 @@ fn matrix_iter_columns_fuse() {
let m = matrix![1, 3, 3, 7];
let mut iter = m.iter_columns();
for _ in 0..4 {
assert!(matches!(iter.next(), Some(_)));
assert!(iter.next().is_some());
}
for _ in 0..10 {
assert!(matches!(iter.next(), None));
assert!(iter.next().is_none());
}
}

Expand Down

0 comments on commit 0fd1147

Please sign in to comment.