From d808f938bc47d72fd5f7ff879a33e6be9bb6a499 Mon Sep 17 00:00:00 2001 From: timvisee Date: Mon, 14 Jan 2019 21:20:01 +0100 Subject: [PATCH] Simplify 'product' factorial example --- src/libcore/iter/iterator.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs index 640af74817282..0ad29afbadeac 100644 --- a/src/libcore/iter/iterator.rs +++ b/src/libcore/iter/iterator.rs @@ -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);