diff --git a/src/dimension/mod.rs b/src/dimension/mod.rs index eb07252b2..4ada0b127 100644 --- a/src/dimension/mod.rs +++ b/src/dimension/mod.rs @@ -269,7 +269,7 @@ fn can_index_slice_impl( ) -> 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)); } diff --git a/src/impl_methods.rs b/src/impl_methods.rs index 9a1741be6..01a0a9a4d 100644 --- a/src/impl_methods.rs +++ b/src/impl_methods.rs @@ -2338,7 +2338,7 @@ impl ArrayRef /// 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}; @@ -2690,7 +2690,7 @@ where impl ArrayRef { - /// 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`. /// @@ -2702,7 +2702,7 @@ impl ArrayRef 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. @@ -2718,7 +2718,7 @@ impl ArrayRef 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 { @@ -3212,7 +3212,7 @@ impl ArrayRef 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; }