Skip to content

Commit

Permalink
Use clone_from() in two places
Browse files Browse the repository at this point in the history
In `fill()` and in `assign()`.
  • Loading branch information
ChayimFriedman2 authored and adamreichold committed Jan 12, 2024
1 parent 23d7cab commit 4374a9c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/impl_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1431,7 +1431,7 @@ where
///
/// The windows are all distinct views of size `window_size`
/// that fit into the array's shape.
///
///
/// The stride is ordered by the outermost axis.<br>
/// Hence, a (x₀, x₁, ..., xₙ) stride will be applied to
/// (A₀, A₁, ..., Aₙ) where Aₓ stands for `Axis(x)`.
Expand All @@ -1441,7 +1441,7 @@ where
///
/// The produced element is an `ArrayView<A, D>` with exactly the dimension
/// `window_size`.
///
///
/// Note that passing a stride of only ones is similar to
/// calling [`ArrayBase::windows()`].
///
Expand Down Expand Up @@ -2374,7 +2374,7 @@ where
A: Clone,
S2: Data<Elem = A>,
{
self.zip_mut_with(rhs, |x, y| *x = y.clone());
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`.
Expand All @@ -2400,7 +2400,7 @@ where
S: DataMut,
A: Clone,
{
self.map_inplace(move |elt| *elt = x.clone());
self.map_inplace(move |elt| elt.clone_from(&x));
}

pub(crate) fn zip_mut_with_same_shape<B, S2, E, F>(&mut self, rhs: &ArrayBase<S2, E>, mut f: F)
Expand Down

0 comments on commit 4374a9c

Please sign in to comment.