Skip to content

Commit dceb0f0

Browse files
authored
Merge pull request #360 from cuviper/collect_vec_list
Use rayon-1.9.0's `collect_vec_list`
2 parents bf0362b + c095322 commit dceb0f0

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

.github/workflows/ci.yml

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ jobs:
4848
- uses: dtolnay/rust-toolchain@master
4949
with:
5050
toolchain: ${{ matrix.rust }}
51+
- name: Downgrade dependencies
52+
if: matrix.rust == '1.63.0'
53+
run: |
54+
cargo generate-lockfile
55+
cargo update -p hashbrown --precise 0.15.0
5156
- name: Tests
5257
run: |
5358
cargo build --verbose --features "${{ matrix.features }}"
@@ -83,6 +88,11 @@ jobs:
8388
with:
8489
toolchain: ${{ matrix.rust }}
8590
target: ${{ matrix.target }}
91+
- name: Downgrade dependencies
92+
if: matrix.rust == '1.63.0'
93+
run: |
94+
cargo generate-lockfile
95+
cargo update -p hashbrown --precise 0.15.0
8696
- name: Tests
8797
run: |
8898
cargo build -vv --target=${{ matrix.target }} --no-default-features

Cargo.toml

+1-1
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

+1-14
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)