@@ -2792,9 +2792,9 @@ impl<T, R> InternIteratorElement<T, R> for T {
2792
2792
) -> Self :: Output {
2793
2793
// This code is hot enough that it's worth specializing for the most
2794
2794
// 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` .
2798
2798
match iter. size_hint ( ) {
2799
2799
( 0 , Some ( 0 ) ) => {
2800
2800
assert ! ( iter. next( ) . is_none( ) ) ;
@@ -2835,9 +2835,10 @@ impl<T, R, E> InternIteratorElement<T, R> for Result<T, E> {
2835
2835
) -> Self :: Output {
2836
2836
// This code is hot enough that it's worth specializing for the most
2837
2837
// 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.
2841
2842
Ok ( match iter. size_hint ( ) {
2842
2843
( 0 , Some ( 0 ) ) => {
2843
2844
assert ! ( iter. next( ) . is_none( ) ) ;
0 commit comments