Opt for .cloned() over .map(|x| x.clone()) etc.

This commit is contained in:
Kevin Butler 2015-02-13 07:33:44 +00:00
parent 5705d48e28
commit 2f586b9687
39 changed files with 67 additions and 81 deletions

View file

@ -350,7 +350,7 @@ pub trait IteratorExt: Iterator + Sized {
///
/// ```
/// let xs = [100, 200, 300];
/// let mut it = xs.iter().map(|x| *x).peekable();
/// let mut it = xs.iter().cloned().peekable();
/// assert_eq!(*it.peek().unwrap(), 100);
/// assert_eq!(it.next().unwrap(), 100);
/// assert_eq!(it.next().unwrap(), 200);