Skip to content

Commit

Permalink
Fix a few clippy lints
Browse files Browse the repository at this point in the history
Fix the min_value() / max_value() lints.

Also remove clippy::many_single_char_names, clippy::unreadable_literal
from the allow list since they are not needed anymore.
  • Loading branch information
bluss committed Aug 1, 2024
1 parent 3330cbf commit 99e3f31
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,7 @@ where
let dim = self.raw_dim();
Zip::from(LanesMut::new(self.view_mut(), Axis(n - 1)))
.and(Lanes::new(rhs.broadcast_assume(dim), Axis(n - 1)))
.for_each(move |s_row, r_row| Zip::from(s_row).and(r_row).for_each(|a, b| f(a, b)));
.for_each(move |s_row, r_row| Zip::from(s_row).and(r_row).for_each(&mut f));
}

fn zip_mut_with_elem<B, F>(&mut self, rhs_elem: &B, mut f: F)
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
#![doc(html_logo_url = "https://rust-ndarray.github.io/images/rust-ndarray_logo.svg")]
#![allow(
unstable_name_collisions, // our `PointerExt` collides with upcoming inherent methods on `NonNull`
clippy::many_single_char_names,
clippy::deref_addrof,
clippy::unreadable_literal,
clippy::manual_map, // is not an error
clippy::while_let_on_iterator, // is not an error
clippy::from_iter_instead_of_collect, // using from_iter is good style
clippy::redundant_closure, // false positives clippy #7812
clippy::incompatible_msrv, // false positive PointerExt::offset
)]
#![doc(test(attr(deny(warnings))))]
Expand Down
10 changes: 5 additions & 5 deletions src/linalg/impl_linalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,11 @@ where
if !same_type::<A, S::Elem>() {
return false;
}
if a.len() > blas_index::max_value() as usize {
if a.len() > blas_index::MAX as usize {
return false;
}
let stride = a.strides()[0];
if stride == 0 || stride > blas_index::max_value() as isize || stride < blas_index::min_value() as isize {
if stride == 0 || stride > blas_index::MAX as isize || stride < blas_index::MIN as isize {
return false;
}
true
Expand Down Expand Up @@ -882,12 +882,12 @@ fn is_blas_2d(dim: &Ix2, stride: &Ix2, order: MemoryOrder) -> bool
if s0 < 1 || s1 < 1 {
return false;
}
if (s0 > blas_index::max_value() as isize || s0 < blas_index::min_value() as isize)
|| (s1 > blas_index::max_value() as isize || s1 < blas_index::min_value() as isize)
if (s0 > blas_index::MAX as isize || s0 < blas_index::MIN as isize)
|| (s1 > blas_index::MAX as isize || s1 < blas_index::MIN as isize)
{
return false;
}
if m > blas_index::max_value() as usize || n > blas_index::max_value() as usize {
if m > blas_index::MAX as usize || n > blas_index::MAX as usize {
return false;
}
true
Expand Down

0 comments on commit 99e3f31

Please sign in to comment.