Skip to content

Commit f129374

Browse files
committed
Use repeat instead of RangeFrom
1 parent 0be5173 commit f129374

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/libcore/iter/mod.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,10 @@
305305
//! successfully for any infinite iterators.
306306
//!
307307
//! ```no_run
308-
//! let positives = 1..;
309-
//! let least = positives.min().unwrap(); // Oh no! An infinite loop!
310-
//! // `positives.min` will either overflow and panic (in debug mode),
311-
//! // or cause an infinite loop (in release mode), so we won't reach
312-
//! // this point!
313-
//! println!("The least positive number is {}.", least);
308+
//! let ones = std::iter::repeat(1);
309+
//! let least = ones.min().unwrap(); // Oh no! An infinite loop!
310+
//! // `ones.min()` causes an infinite loop, so we won't reach this point!
311+
//! println!("The smallest number one is {}.", least);
314312
//! ```
315313
//!
316314
//! [`take`]: trait.Iterator.html#method.take

0 commit comments

Comments
 (0)