We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Hash
1 parent b3b36c6 commit fb2957eCopy full SHA for fb2957e
tests/mod.rs
@@ -258,6 +258,24 @@ fn from_fn() {
258
assert_eq!(array.as_slice(), EXAMPLE_SLICE);
259
}
260
261
+#[test]
262
+#[allow(clippy::std_instead_of_core)]
263
+fn hash() {
264
+ use std::hash::{DefaultHasher, Hash, Hasher};
265
+
266
+ type A = Array<u8, U2>;
267
+ let array1: A = Array([1, 2]);
268
+ let array2: A = Array([1, 3]);
269
270
+ let mut hasher1 = DefaultHasher::new();
271
+ array1.hash(&mut hasher1);
272
273
+ let mut hasher2 = DefaultHasher::new();
274
+ array2.hash(&mut hasher2);
275
276
+ assert_ne!(hasher1.finish(), hasher2.finish());
277
+}
278
279
#[test]
280
fn tryfrom_slice_for_clonable_array() {
281
assert!(Array::<u8, U0>::try_from(EXAMPLE_SLICE).is_err());
0 commit comments