1
Fork 0

Simplify 'product' factorial example

This commit is contained in:
timvisee 2019-01-14 21:20:01 +01:00
parent d10680818b
commit d808f938bc
No known key found for this signature in database
GPG key ID: B8DB720BC383E172

View file

@ -2358,7 +2358,7 @@ pub trait Iterator {
///
/// ```
/// fn factorial(n: u32) -> u32 {
/// (1..).take_while(|&i| i <= n).product()
/// (1..=n).product()
/// }
/// assert_eq!(factorial(0), 1);
/// assert_eq!(factorial(1), 1);