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.
This commit is contained in:
parent
abc3073c92
commit
3d47ebeb0e
1 changed files with 2 additions and 8 deletions
|
@ -203,11 +203,7 @@ cfg_if! {
|
||||||
t.into_iter()
|
t.into_iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn par_for_each_in<T: IntoIterator>(
|
pub fn par_for_each_in<T: IntoIterator>(t: T, for_each: impl Fn(T::Item) + Sync + Send) {
|
||||||
t: T,
|
|
||||||
for_each:
|
|
||||||
impl Fn(<<T as IntoIterator>::IntoIter as Iterator>::Item) + Sync + Send
|
|
||||||
) {
|
|
||||||
// We catch panics here ensuring that all the loop iterations execute.
|
// We catch panics here ensuring that all the loop iterations execute.
|
||||||
// This makes behavior consistent with the parallel compiler.
|
// This makes behavior consistent with the parallel compiler.
|
||||||
let mut panic = None;
|
let mut panic = None;
|
||||||
|
@ -397,9 +393,7 @@ cfg_if! {
|
||||||
|
|
||||||
pub fn par_for_each_in<T: IntoParallelIterator>(
|
pub fn par_for_each_in<T: IntoParallelIterator>(
|
||||||
t: T,
|
t: T,
|
||||||
for_each: impl Fn(
|
for_each: impl Fn(T::Item) + Sync + Send,
|
||||||
<<T as IntoParallelIterator>::Iter as ParallelIterator>::Item
|
|
||||||
) + Sync + Send
|
|
||||||
) {
|
) {
|
||||||
t.into_par_iter().for_each(for_each)
|
t.into_par_iter().for_each(for_each)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue