Skip to content

Commit

Permalink
Simplify the signature of par_for_each_in
Browse files Browse the repository at this point in the history
Given `T: IntoIterator`/`IntoParallelIterator`, `T::Item` is
unambiguous, so we don't need the explicit trait casting.
  • Loading branch information
cuviper committed Feb 26, 2020
1 parent abc3073 commit 3d47ebe
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/librustc_data_structures/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,7 @@ cfg_if! {
t.into_iter()
}

pub fn par_for_each_in<T: IntoIterator>(
t: T,
for_each:
impl Fn(<<T as IntoIterator>::IntoIter as Iterator>::Item) + Sync + Send
) {
pub fn par_for_each_in<T: IntoIterator>(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;
Expand Down Expand Up @@ -397,9 +393,7 @@ cfg_if! {

pub fn par_for_each_in<T: IntoParallelIterator>(
t: T,
for_each: impl Fn(
<<T as IntoParallelIterator>::Iter as ParallelIterator>::Item
) + Sync + Send
for_each: impl Fn(T::Item) + Sync + Send,
) {
t.into_par_iter().for_each(for_each)
}
Expand Down

0 comments on commit 3d47ebe

Please sign in to comment.