Skip to content

Commit

Permalink
Use repeat instead of RangeFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Jan 21, 2018
1 parent 0be5173 commit f129374
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,10 @@
//! successfully for any infinite iterators.
//!
//! ```no_run
//! let positives = 1..;
//! let least = positives.min().unwrap(); // Oh no! An infinite loop!
//! // `positives.min` will either overflow and panic (in debug mode),
//! // or cause an infinite loop (in release mode), so we won't reach
//! // this point!
//! println!("The least positive number is {}.", least);
//! let ones = std::iter::repeat(1);
//! let least = ones.min().unwrap(); // Oh no! An infinite loop!
//! // `ones.min()` causes an infinite loop, so we won't reach this point!
//! println!("The smallest number one is {}.", least);
//! ```
//!
//! [`take`]: trait.Iterator.html#method.take
Expand Down

0 comments on commit f129374

Please sign in to comment.