@@ -2792,9 +2792,9 @@ impl<T, R> InternIteratorElement<T, R> for T {
27922792 ) -> Self :: Output {
27932793 // This code is hot enough that it's worth specializing for the most
27942794 // common length lists, to avoid the overhead of `SmallVec` creation.
2795- // Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
2796- // that if the upper and lower bounds from `size_hint` agree they are
2797- // correct .
2795+ // Lengths 0, 1, and 2 typically account for ~95% of cases. If
2796+ // `size_hint` is incorrect a panic will occur via an `unwrap` or an
2797+ // `assert` .
27982798 match iter. size_hint ( ) {
27992799 ( 0 , Some ( 0 ) ) => {
28002800 assert ! ( iter. next( ) . is_none( ) ) ;
@@ -2835,9 +2835,10 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
28352835 ) -> Self :: Output {
28362836 // This code is hot enough that it's worth specializing for the most
28372837 // common length lists, to avoid the overhead of `SmallVec` creation.
2838- // Lengths 0, 1, and 2 typically account for ~95% of cases. We assume
2839- // that if the upper and lower bounds from `size_hint` agree they are
2840- // correct.
2838+ // Lengths 0, 1, and 2 typically account for ~95% of cases. If
2839+ // `size_hint` is incorrect a panic will occur via an `unwrap` or an
2840+ // `assert`, unless a failure happens first, in which case the result
2841+ // will be an error anyway.
28412842 Ok ( match iter. size_hint ( ) {
28422843 ( 0 , Some ( 0 ) ) => {
28432844 assert ! ( iter. next( ) . is_none( ) ) ;
0 commit comments