about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-15 15:18:16 +0000
committerbors <bors@rust-lang.org>2021-04-15 15:18:16 +0000
commit2962e7c0089d5c136f4e9600b7abccfbbde4973d (patch)
treea695d39c47494777e5c474353ada1b375420e8aa
parentf1ca558db189690a9774713306c94550681ac590 (diff)
parenteeac70c567d9f905a1e905165f1cae1eb5305c00 (diff)
downloadrust-2962e7c0089d5c136f4e9600b7abccfbbde4973d.tar.gz
rust-2962e7c0089d5c136f4e9600b7abccfbbde4973d.zip
Auto merge of #84209 - pickfire:patch-3, r=jyn514
Merge same condition branch in vec spec_extend

Follow up of https://github.com/rust-lang/rust/pull/83726#discussion_r613438246
-rw-r--r--library/alloc/src/vec/spec_extend.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/library/alloc/src/vec/spec_extend.rs b/library/alloc/src/vec/spec_extend.rs
index e132befcfa5..c6f4f22a01f 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());