remove unnecessary slicing

This was needed in older versions of Rust that are not supported
anymore by this crate.
This commit is contained in:
Antoni Spaanderman 2024-08-26 13:34:45 +02:00
parent 22e42ab86c
commit fa3a3afd02
No known key found for this signature in database
GPG Key ID: AE0B68E552E5DF8C
9 changed files with 9 additions and 9 deletions

View File

@ -88,7 +88,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = hash160::Hash::hash(&test.input[..]); let hash = hash160::Hash::hash(&test.input[..]);
assert_eq!(hash, test.output_str.parse::<hash160::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<hash160::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -477,7 +477,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = ripemd160::Hash::hash(test.input.as_bytes()); let hash = ripemd160::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<ripemd160::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<ripemd160::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
assert_eq!(ripemd160::Hash::from_bytes_ref(&test.output), &hash); assert_eq!(ripemd160::Hash::from_bytes_ref(&test.output), &hash);
assert_eq!(ripemd160::Hash::from_bytes_mut(&mut test.output), &hash); assert_eq!(ripemd160::Hash::from_bytes_mut(&mut test.output), &hash);

View File

@ -183,7 +183,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha1::Hash::hash(test.input.as_bytes()); let hash = sha1::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha1::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha1::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -916,7 +916,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha256::Hash::hash(test.input.as_bytes()); let hash = sha256::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha256::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha256::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -76,7 +76,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha256d::Hash::hash(test.input.as_bytes()); let hash = sha256d::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha256d::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha256d::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -123,7 +123,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha384::Hash::hash(test.input.as_bytes()); let hash = sha384::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha384::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha384::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -370,7 +370,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha512::Hash::hash(test.input.as_bytes()); let hash = sha512::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha512::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha512::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -123,7 +123,7 @@ mod tests {
// Hash through high-level API, check hex encoding/decoding // Hash through high-level API, check hex encoding/decoding
let hash = sha512_256::Hash::hash(test.input.as_bytes()); let hash = sha512_256::Hash::hash(test.input.as_bytes());
assert_eq!(hash, test.output_str.parse::<sha512_256::Hash>().expect("parse hex")); assert_eq!(hash, test.output_str.parse::<sha512_256::Hash>().expect("parse hex"));
assert_eq!(&hash[..], &test.output[..]); assert_eq!(&hash[..], &test.output);
assert_eq!(&hash.to_string(), &test.output_str); assert_eq!(&hash.to_string(), &test.output_str);
// Hash through engine, checking that we can input byte by byte // Hash through engine, checking that we can input byte by byte

View File

@ -318,7 +318,7 @@ mod tests {
for i in 0..64 { for i in 0..64 {
vin[i] = i as u8; vin[i] = i as u8;
let vec = Hash::from_slice(&vecs[i][..]).unwrap(); let vec = Hash::from_slice(&vecs[i]).unwrap();
let out = Hash::hash_with_keys(k0, k1, &vin[0..i]); let out = Hash::hash_with_keys(k0, k1, &vin[0..i]);
assert_eq!(vec, out, "vec #{}", i); assert_eq!(vec, out, "vec #{}", i);