summaryrefslogtreecommitdiffstats
path: root/vendor/crc32fast/debian/patches/dont-fail-bench-if-no-specialized.diff
blob: 5970b6189707cc4bc4ad27e7f49acb9e1fa0df32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Description: Don't fail the benches if no specialized implementation is available.
Author: Peter Michael Green <plugwash@debian.org>

--- rust-crc32fast-1.3.2.orig/benches/bench.rs
+++ rust-crc32fast-1.3.2/benches/bench.rs
@@ -25,7 +25,10 @@ fn bench_kilobyte_baseline(b: &mut Bench
 }
 
 fn bench_kilobyte_specialized(b: &mut Bencher) {
-    bench(b, 1024, Hasher::internal_new_specialized(0, 0).unwrap())
+    let hasher = Hasher::internal_new_specialized(0, 0);
+    if let Some(hasher) = hasher {
+	bench(b, 1024, hasher)
+    }
 }
 
 fn bench_megabyte_baseline(b: &mut Bencher) {
@@ -33,11 +36,10 @@ fn bench_megabyte_baseline(b: &mut Bench
 }
 
 fn bench_megabyte_specialized(b: &mut Bencher) {
-    bench(
-        b,
-        1024 * 1024,
-        Hasher::internal_new_specialized(0, 0).unwrap(),
-    )
+    let hasher = Hasher::internal_new_specialized(0, 0);
+    if let Some(hasher) = hasher {
+        bench(b, 1024 * 1024, hasher)
+    }
 }
 
 benchmark_group!(