Opt for .cloned() over .map(|x| x.clone()) etc.
This commit is contained in:
parent
5705d48e28
commit
2f586b9687
39 changed files with 67 additions and 81 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue