Skip to content

Commit dbdbf87

Browse files
Philippe-Choletjswrenn
authored andcommitted
Fix ignored doctest of size_hint::mul
This doctest can not run because this function (and module) is private.
1 parent 71a2a9f commit dbdbf87

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/size_hint.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@ pub fn sub_scalar(sh: SizeHint, x: usize) -> SizeHint {
3838
}
3939

4040
/// Multiply `SizeHint` correctly
41-
///
42-
/// ```ignore
43-
/// use std::usize;
44-
/// use itertools::size_hint;
45-
///
46-
/// assert_eq!(size_hint::mul((3, Some(4)), (3, Some(4))),
47-
/// (9, Some(16)));
48-
///
49-
/// assert_eq!(size_hint::mul((3, Some(4)), (usize::MAX, None)),
50-
/// (usize::MAX, None));
51-
///
52-
/// assert_eq!(size_hint::mul((3, None), (0, Some(0))),
53-
/// (0, Some(0)));
54-
/// ```
5541
#[inline]
5642
pub fn mul(a: SizeHint, b: SizeHint) -> SizeHint {
5743
let low = a.0.saturating_mul(b.0);
@@ -100,3 +86,10 @@ pub fn min(a: SizeHint, b: SizeHint) -> SizeHint {
10086
};
10187
(lower, upper)
10288
}
89+
90+
#[test]
91+
fn mul_size_hints() {
92+
assert_eq!(mul((3, Some(4)), (3, Some(4))), (9, Some(16)));
93+
assert_eq!(mul((3, Some(4)), (usize::MAX, None)), (usize::MAX, None));
94+
assert_eq!(mul((3, None), (0, Some(0))), (0, Some(0)));
95+
}

0 commit comments

Comments
 (0)