Skip to content

Commit

Permalink
Use truncate in clone_from
Browse files Browse the repository at this point in the history
  • Loading branch information
a1phyr committed May 24, 2021
1 parent 7b290b7 commit 6be5ed4
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/arrayvec.rs
Expand Up @@ -1079,9 +1079,7 @@ impl<T, const CAP: usize> Clone for ArrayVec<T, CAP>

if prefix < self.len() {
// rhs was shorter
for _ in 0..self.len() - prefix {
self.pop();
}
self.truncate(prefix);
} else {
let rhs_elems = &rhs[self.len()..];
self.extend_from_slice(rhs_elems);
Expand Down

0 comments on commit 6be5ed4

Please sign in to comment.