From 2d3c873d2abf96bf20e88c3319a0d951cb1b6da7 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 6 Nov 2017 13:12:19 -0800 Subject: [PATCH] Remove unnecessary clones --- src/iter/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/iter/mod.rs b/src/iter/mod.rs index bc5eb8c22..58e09cda3 100644 --- a/src/iter/mod.rs +++ b/src/iter/mod.rs @@ -611,7 +611,7 @@ pub trait ParallelIterator: Sized + Send { /// ``` /// use rayon::prelude::*; /// let a = [-3_i32, 77, 53, 240, -1]; - /// assert_eq!(a.par_iter().cloned().min_by(|x, y| x.cmp(y)), Some(-3)); + /// assert_eq!(a.par_iter().min_by(|x, y| x.cmp(y)), Some(&-3)); /// ``` fn min_by(self, f: F) -> Option where F: Sync + Send + Fn(&Self::Item, &Self::Item) -> Ordering @@ -633,7 +633,7 @@ pub trait ParallelIterator: Sized + Send { /// ``` /// use rayon::prelude::*; /// let a = [-3_i32, 34, 2, 5, -10, -3, -23]; - /// assert_eq!(a.par_iter().cloned().min_by_key(|x| x.abs()), Some(2)); + /// assert_eq!(a.par_iter().min_by_key(|x| x.abs()), Some(&2)); /// ``` fn min_by_key(self, f: F) -> Option where K: Ord + Send, @@ -678,7 +678,7 @@ pub trait ParallelIterator: Sized + Send { /// ``` /// use rayon::prelude::*; /// let a = [-3_i32, 77, 53, 240, -1]; - /// assert_eq!(a.par_iter().cloned().max_by(|x, y| x.abs().cmp(&y.abs())), Some(240)); + /// assert_eq!(a.par_iter().max_by(|x, y| x.abs().cmp(&y.abs())), Some(&240)); /// ``` fn max_by(self, f: F) -> Option where F: Sync + Send + Fn(&Self::Item, &Self::Item) -> Ordering @@ -700,7 +700,7 @@ pub trait ParallelIterator: Sized + Send { /// ``` /// use rayon::prelude::*; /// let a = [-3_i32, 34, 2, 5, -10, -3, -23]; - /// assert_eq!(a.par_iter().cloned().max_by_key(|x| x.abs()), Some(34)); + /// assert_eq!(a.par_iter().max_by_key(|x| x.abs()), Some(&34)); /// ``` fn max_by_key(self, f: F) -> Option where K: Ord + Send,