Skip to content

Move from .iter().any() to .contains and fixes some typos #1509

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dimension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ fn can_index_slice_impl<D: Dimension>(
) -> Result<(), ShapeError>
{
// Check condition 3.
let is_empty = dim.slice().iter().any(|&d| d == 0);
let is_empty = dim.slice().contains(&0);
if is_empty && max_offset > data_len {
return Err(from_kind(ErrorKind::OutOfBounds));
}
Expand Down
10 changes: 5 additions & 5 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
/// The implementation creates a view with strides set to zero for the
/// axes that are to be repeated.
///
/// The broadcasting documentation for Numpy has more information.
/// The broadcasting documentation for NumPy has more information.
///
/// ```
/// use ndarray::{aview1, aview2};
Expand Down Expand Up @@ -2690,7 +2690,7 @@ where

impl<A, D: Dimension> ArrayRef<A, D>
{
/// Perform an elementwise assigment to `self` from `rhs`.
/// Perform an elementwise assignment to `self` from `rhs`.
///
/// If their shapes disagree, `rhs` is broadcast to the shape of `self`.
///
Expand All @@ -2702,7 +2702,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
self.zip_mut_with(rhs, |x, y| x.clone_from(y));
}

/// Perform an elementwise assigment of values cloned from `self` into array or producer `to`.
/// Perform an elementwise assignment of values cloned from `self` into array or producer `to`.
///
/// The destination `to` can be another array or a producer of assignable elements.
/// [`AssignElem`] determines how elements are assigned.
Expand All @@ -2718,7 +2718,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
Zip::from(self).map_assign_into(to, A::clone);
}

/// Perform an elementwise assigment to `self` from element `x`.
/// Perform an elementwise assignment to `self` from element `x`.
pub fn fill(&mut self, x: A)
where A: Clone
{
Expand Down Expand Up @@ -3212,7 +3212,7 @@ impl<A, D: Dimension> ArrayRef<A, D>
let mut result = self.to_owned();

// Return early if the array has zero-length dimensions
if self.shape().iter().any(|s| *s == 0) {
if result.shape().contains(&0) {
return result;
}

Expand Down
Loading