Skip to content

Commit cb31373

Browse files
committed
early return if 1 element
No need to dedup if there is only 1 element in the vec, can early return
1 parent 2228ce1 commit cb31373

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ impl<T: PartialEq> Vec<T> {
12131213
// Duplicate, advance r. End of vec. Truncate to w.
12141214

12151215
let ln = self.len();
1216-
if ln < 1 { return; }
1216+
if ln <= 1 { return; }
12171217

12181218
// Avoid bounds checks by using unsafe pointers.
12191219
let p = self.as_mut_ptr();

0 commit comments

Comments
 (0)