From 3d47ebeb0e96e328f247cb691f376e6431f258aa Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 26 Feb 2020 15:08:21 -0800 Subject: [PATCH] Simplify the signature of par_for_each_in Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is unambiguous, so we don't need the explicit trait casting. --- src/librustc_data_structures/sync.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/librustc_data_structures/sync.rs b/src/librustc_data_structures/sync.rs index fa98b4d72dda2..9051b1751b119 100644 --- a/src/librustc_data_structures/sync.rs +++ b/src/librustc_data_structures/sync.rs @@ -203,11 +203,7 @@ cfg_if! { t.into_iter() } - pub fn par_for_each_in( - t: T, - for_each: - impl Fn(<::IntoIter as Iterator>::Item) + Sync + Send - ) { + pub fn par_for_each_in(t: T, for_each: impl Fn(T::Item) + Sync + Send) { // We catch panics here ensuring that all the loop iterations execute. // This makes behavior consistent with the parallel compiler. let mut panic = None; @@ -397,9 +393,7 @@ cfg_if! { pub fn par_for_each_in( t: T, - for_each: impl Fn( - <::Iter as ParallelIterator>::Item - ) + Sync + Send + for_each: impl Fn(T::Item) + Sync + Send, ) { t.into_par_iter().for_each(for_each) }