Skip to content

Commit

Permalink
Avoid legacy numeric constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold committed May 19, 2024
1 parent f5d17e5 commit cddb2ee
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/arrayformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ impl FormatOptions
fn set_no_limit(mut self, no_limit: bool) -> Self
{
if no_limit {
self.axis_collapse_limit = std::usize::MAX;
self.axis_collapse_limit_next_last = std::usize::MAX;
self.axis_collapse_limit_last = std::usize::MAX;
self.axis_collapse_limit = usize::MAX;
self.axis_collapse_limit_next_last = usize::MAX;
self.axis_collapse_limit_last = usize::MAX;
}
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/arraytraits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ where Slice: AsMut<[A]>
let xs = slice.as_mut();
if mem::size_of::<A>() == 0 {
assert!(
xs.len() <= ::std::isize::MAX as usize,
xs.len() <= isize::MAX as usize,
"Slice length must fit in `isize`.",
);
}
Expand Down
3 changes: 1 addition & 2 deletions src/dimension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub use self::remove_axis::RemoveAxis;
pub(crate) use self::axes::axes_of;
pub(crate) use self::reshape::reshape_dim;

use std::isize;
use std::mem;

#[macro_use]
Expand Down Expand Up @@ -94,7 +93,7 @@ pub fn size_of_shape_checked<D: Dimension>(dim: &D) -> Result<usize, ShapeError>
.filter(|&&d| d != 0)
.try_fold(1usize, |acc, &d| acc.checked_mul(d))
.ok_or_else(|| from_kind(ErrorKind::Overflow))?;
if size_nonzero > ::std::isize::MAX as usize {
if size_nonzero > isize::MAX as usize {
Err(from_kind(ErrorKind::Overflow))
} else {
Ok(dim.size())
Expand Down
2 changes: 1 addition & 1 deletion src/linalg/impl_linalg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ where
fn dot_shape_error(m: usize, k: usize, k2: usize, n: usize) -> !
{
match m.checked_mul(n) {
Some(len) if len <= ::std::isize::MAX as usize => {}
Some(len) if len <= isize::MAX as usize => {}
_ => panic!("ndarray: shape {} × {} overflows isize", m, n),
}
panic!(
Expand Down

0 comments on commit cddb2ee

Please sign in to comment.