Skip to content

Commit 7d8cef8

Browse files
committed
Use rayon-1.9.0's collect_vec_list
1 parent bf0362b commit 7d8cef8

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ arbitrary = { version = "1.0", optional = true, default-features = false }
2020
quickcheck = { version = "1.0", optional = true, default-features = false }
2121
serde = { version = "1.0", optional = true, default-features = false }
2222
borsh = { version = "1.2", optional = true, default-features = false }
23-
rayon = { version = "1.5.3", optional = true }
23+
rayon = { version = "1.9", optional = true }
2424

2525
# Internal feature, only used when building as part of rustc,
2626
# not part of the stable interface of this crate.

src/rayon/mod.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,5 @@ pub mod set;
1212
// This form of intermediate collection is also how Rayon collects `HashMap`.
1313
// Note that the order will also be preserved!
1414
fn collect<I: IntoParallelIterator>(iter: I) -> LinkedList<Vec<I::Item>> {
15-
iter.into_par_iter()
16-
.fold(Vec::new, |mut vec, elem| {
17-
vec.push(elem);
18-
vec
19-
})
20-
.map(|vec| {
21-
let mut list = LinkedList::new();
22-
list.push_back(vec);
23-
list
24-
})
25-
.reduce(LinkedList::new, |mut list1, mut list2| {
26-
list1.append(&mut list2);
27-
list1
28-
})
15+
iter.into_par_iter().collect_vec_list()
2916
}

0 commit comments

Comments
 (0)