Fix std tests

This commit is contained in:
Ryan Levick 2021-01-07 13:13:25 +01:00 committed by Ryan Levick
parent d3b49c2ed2
commit c5ff54cbdb

View File

@ -774,11 +774,11 @@ fn test_occupied_entry_key() {
let key = "hello there"; let key = "hello there";
let value = "value goes here"; let value = "value goes here";
assert!(a.is_empty()); assert!(a.is_empty());
a.insert(key.clone(), value.clone()); a.insert(key, value);
assert_eq!(a.len(), 1); assert_eq!(a.len(), 1);
assert_eq!(a[key], value); assert_eq!(a[key], value);
match a.entry(key.clone()) { match a.entry(key) {
Vacant(_) => panic!(), Vacant(_) => panic!(),
Occupied(e) => assert_eq!(key, *e.key()), Occupied(e) => assert_eq!(key, *e.key()),
} }
@ -793,11 +793,11 @@ fn test_vacant_entry_key() {
let value = "value goes here"; let value = "value goes here";
assert!(a.is_empty()); assert!(a.is_empty());
match a.entry(key.clone()) { match a.entry(key) {
Occupied(_) => panic!(), Occupied(_) => panic!(),
Vacant(e) => { Vacant(e) => {
assert_eq!(key, *e.key()); assert_eq!(key, *e.key());
e.insert(value.clone()); e.insert(value);
} }
} }
assert_eq!(a.len(), 1); assert_eq!(a.len(), 1);