Skip to content

Commit dacfb24

Browse files
committed
MAINT: Drop twox-hash from test-nostd to fix the builder for Rust 1.36
Drop this dependency so that we don't have random rust version breaks or other issues. We can use a simple dummy hasher instead.
1 parent 01901ae commit dacfb24

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

test-nostd/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@ edition = "2018"
77

88
[dependencies]
99
indexmap = { path = "..", features = ["serde-1"] }
10-
# no-std compatible hasher
11-
twox-hash = { version = "1.5", default-features = false }
1210

1311
[dev-dependencies]

test-nostd/src/lib.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
#![no_std]
22

33
use core::hash::BuildHasherDefault;
4+
use core::hash::Hasher;
5+
use core::iter::FromIterator;
6+
47
use indexmap::IndexMap;
58
use indexmap::IndexSet;
6-
use twox_hash::XxHash64;
7-
type Map<K, V> = IndexMap<K, V, BuildHasherDefault<XxHash64>>;
8-
type Set<T> = IndexSet<T, BuildHasherDefault<XxHash64>>;
99

10-
use core::iter::FromIterator;
10+
#[derive(Default)]
11+
struct BadHasher(u64);
12+
13+
impl Hasher for BadHasher {
14+
fn finish(&self) -> u64 { self.0 }
15+
fn write(&mut self, bytes: &[u8]) {
16+
for &byte in bytes {
17+
self.0 += byte as u64
18+
}
19+
}
20+
}
21+
22+
type Map<K, V> = IndexMap<K, V, BuildHasherDefault<BadHasher>>;
23+
type Set<T> = IndexSet<T, BuildHasherDefault<BadHasher>>;
1124

1225
pub fn test_compile() {
1326
let mut map = Map::default();

0 commit comments

Comments
 (0)