From cb31373dc26ca447f7a4a142b2ed352677fb55a0 Mon Sep 17 00:00:00 2001 From: Johann Tuffe Date: Wed, 10 Jun 2015 10:51:48 +0800 Subject: early return if 1 element No need to dedup if there is only 1 element in the vec, can early return --- src/libcollections/vec.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 0cc0108fd01..c4921cb8560 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1213,7 +1213,7 @@ impl Vec { // 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(); -- cgit 1.4.1-3-g733a5