Skip to content

Commit

Permalink
Merge branch 'master' into presubmit
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaitchuck committed Feb 11, 2024
2 parents 3ba5c90 + 71f4742 commit b3ee729
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -12,7 +12,7 @@ edition = "2018"
readme = "README.md"
build = "./build.rs"
exclude = ["/smhasher", "/benchmark_tools"]
rust-version = "1.60.0"
rust-version = "1.72.0"

[lib]
name = "ahash"
Expand Down
26 changes: 26 additions & 0 deletions tests/map_tests.rs
Expand Up @@ -200,6 +200,32 @@ fn test_ahash_alias_set_construction() {
set.insert(1);
}


#[cfg(feature = "std")]
#[test]
fn test_key_ref() {
let mut map = ahash::HashMap::default();
map.insert(1, "test");
assert_eq!(Some((1, "test")), map.remove_entry(&1));

let mut map = ahash::HashMap::default();
map.insert(&1, "test");
assert_eq!(Some((&1, "test")), map.remove_entry(&&1));

let mut m = ahash::HashSet::<Box<String>>::default();
m.insert(Box::from("hello".to_string()));
assert!(m.contains(&"hello".to_string()));

let mut m = ahash::HashSet::<String>::default();
m.insert("hello".to_string());
assert!(m.contains("hello"));

let mut m = ahash::HashSet::<Box<[u8]>>::default();
m.insert(Box::from(&b"hello"[..]));
assert!(m.contains(&b"hello"[..]));
}


fn ahash_vec<H: Hash>(b: &Vec<H>) -> u64 {
let mut total: u64 = 0;
for item in b {
Expand Down

0 comments on commit b3ee729

Please sign in to comment.