From cb31373dc26ca447f7a4a142b2ed352677fb55a0 Mon Sep 17 00:00:00 2001 From: Johann Tuffe Date: Wed, 10 Jun 2015 10:51:48 +0800 Subject: [PATCH] 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(-) diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index 0cc0108fd011..c4921cb8560b 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();