Merge same condition branch in vec spec_extend
This commit is contained in:
parent
9c3b66cff7
commit
eeac70c567
1 changed files with 2 additions and 4 deletions
|
@ -26,15 +26,13 @@ where
|
||||||
default fn spec_extend(&mut self, iterator: I) {
|
default fn spec_extend(&mut self, iterator: I) {
|
||||||
// This is the case for a TrustedLen iterator.
|
// This is the case for a TrustedLen iterator.
|
||||||
let (low, high) = iterator.size_hint();
|
let (low, high) = iterator.size_hint();
|
||||||
if let Some(high_value) = high {
|
if let Some(additional) = high {
|
||||||
debug_assert_eq!(
|
debug_assert_eq!(
|
||||||
low,
|
low,
|
||||||
high_value,
|
additional,
|
||||||
"TrustedLen iterator's size hint is not exact: {:?}",
|
"TrustedLen iterator's size hint is not exact: {:?}",
|
||||||
(low, high)
|
(low, high)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
if let Some(additional) = high {
|
|
||||||
self.reserve(additional);
|
self.reserve(additional);
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut ptr = self.as_mut_ptr().add(self.len());
|
let mut ptr = self.as_mut_ptr().add(self.len());
|
||||||
|
|
Loading…
Reference in a new issue