File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -696,22 +696,20 @@ where
696696 fn size_hint ( & self ) -> ( usize , Option < usize > ) {
697697 use MergeIterState :: * ;
698698
699- // Fundamentally this is a spicy concatenation, so add the sizes together
700- let extra_element = match self . state {
701- LeftExhausted => 0 ,
702- RightExhausted => 0 ,
703- LeftItem ( _) => 1 ,
704- RightItem ( _) => 1 ,
705- } ;
699+ match self . state {
700+ LeftExhausted => return self . right . size_hint ( ) ,
701+ RightExhausted => return self . left . size_hint ( ) ,
702+ LeftItem ( _) | RightItem ( _) => { }
703+ }
706704
705+ // Fundamentally this is a spicy concatenation, so add the sizes together
707706 let ( min1, max1) = self . left . size_hint ( ) ;
708707 let ( min2, max2) = self . right . size_hint ( ) ;
709708
710- let min = min1. saturating_add ( min2) . saturating_add ( extra_element) ;
711-
709+ let min = min1. saturating_add ( min2) . saturating_add ( 1 ) ;
712710 let max = max1
713711 . and_then ( |max| max. checked_add ( max2?) )
714- . and_then ( |max| max. checked_add ( extra_element ) ) ;
712+ . and_then ( |max| max. checked_add ( 1 ) ) ;
715713
716714 ( min, max)
717715 }
You can’t perform that action at this time.
0 commit comments