Skip to content

Commit 6be5ed4

Browse files
committed
Use truncate in clone_from
1 parent 7b290b7 commit 6be5ed4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/arrayvec.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,7 @@ impl<T, const CAP: usize> Clone for ArrayVec<T, CAP>
10791079

10801080
if prefix < self.len() {
10811081
// rhs was shorter
1082-
for _ in 0..self.len() - prefix {
1083-
self.pop();
1084-
}
1082+
self.truncate(prefix);
10851083
} else {
10861084
let rhs_elems = &rhs[self.len()..];
10871085
self.extend_from_slice(rhs_elems);

0 commit comments

Comments
 (0)