Commit f56341d 1 parent 04e73e5 commit f56341d Copy full SHA for f56341d
File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -696,22 +696,20 @@ where
696
696
fn size_hint ( & self ) -> ( usize , Option < usize > ) {
697
697
use MergeIterState :: * ;
698
698
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
+ }
706
704
705
+ // Fundamentally this is a spicy concatenation, so add the sizes together
707
706
let ( min1, max1) = self . left . size_hint ( ) ;
708
707
let ( min2, max2) = self . right . size_hint ( ) ;
709
708
710
- let min = min1. saturating_add ( min2) . saturating_add ( extra_element) ;
711
-
709
+ let min = min1. saturating_add ( min2) . saturating_add ( 1 ) ;
712
710
let max = max1
713
711
. and_then ( |max| max. checked_add ( max2?) )
714
- . and_then ( |max| max. checked_add ( extra_element ) ) ;
712
+ . and_then ( |max| max. checked_add ( 1 ) ) ;
715
713
716
714
( min, max)
717
715
}
You can’t perform that action at this time.
0 commit comments