From eeac70c567d9f905a1e905165f1cae1eb5305c00 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Thu, 15 Apr 2021 11:58:02 +0800 Subject: [PATCH] Merge same condition branch in vec spec_extend --- library/alloc/src/vec/spec_extend.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/alloc/src/vec/spec_extend.rs b/library/alloc/src/vec/spec_extend.rs index e132befcfa5e2..c6f4f22a01f6e 100644 --- a/library/alloc/src/vec/spec_extend.rs +++ b/library/alloc/src/vec/spec_extend.rs @@ -26,15 +26,13 @@ where default fn spec_extend(&mut self, iterator: I) { // This is the case for a TrustedLen iterator. let (low, high) = iterator.size_hint(); - if let Some(high_value) = high { + if let Some(additional) = high { debug_assert_eq!( low, - high_value, + additional, "TrustedLen iterator's size hint is not exact: {:?}", (low, high) ); - } - if let Some(additional) = high { self.reserve(additional); unsafe { let mut ptr = self.as_mut_ptr().add(self.len());