early return if 1 element

No need to dedup if there is only 1 element in the vec, can early return
This commit is contained in:
Johann Tuffe 2015-06-10 10:51:48 +08:00
parent 2228ce10c6
commit cb31373dc2

View File

@ -1213,7 +1213,7 @@ impl<T: PartialEq> Vec<T> {
// Duplicate, advance r. End of vec. Truncate to w.
let ln = self.len();
if ln < 1 { return; }
if ln <= 1 { return; }
// Avoid bounds checks by using unsafe pointers.
let p = self.as_mut_ptr();