]> git.lizzy.rs Git - rust.git/blobdiff - library/alloc/src/vec/spec_extend.rs
Merge same condition branch in vec spec_extend
[rust.git] / library / alloc / src / vec / spec_extend.rs
index e132befcfa5e28cde53d3d5e4589beea325d47b8..c6f4f22a01f6e2170cb382a9ebfb633951c8ad39 100644 (file)
@@ -26,15 +26,13 @@ impl<T, I, A: Allocator> SpecExtend<T, I> for Vec<T, A>
     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());