Remove usage of Cursor in pubkey sanity checks

We do not need to use `Cursor`, `io::Read` is implemented for slices of
`u8`s.
This commit is contained in:
Tobin C. Harding 2024-01-18 08:45:25 +11:00
parent 35b5350088
commit 3ea44a166b
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 6 additions and 5 deletions

View File

@ -1105,11 +1105,12 @@ mod tests {
assert!(PublicKey::read_from(&mut reader).is_err()); assert!(PublicKey::read_from(&mut reader).is_err());
// sanity checks // sanity checks
assert!(PublicKey::read_from(&mut io::Cursor::new(&[])).is_err()); let mut empty: &[u8] = &[];
assert!(PublicKey::read_from(&mut io::Cursor::new(&[0; 33][..])).is_err()); assert!(PublicKey::read_from(&mut empty).is_err());
assert!(PublicKey::read_from(&mut io::Cursor::new(&[2; 32][..])).is_err()); assert!(PublicKey::read_from(&mut &[0; 33][..]).is_err());
assert!(PublicKey::read_from(&mut io::Cursor::new(&[0; 65][..])).is_err()); assert!(PublicKey::read_from(&mut &[2; 32][..]).is_err());
assert!(PublicKey::read_from(&mut io::Cursor::new(&[4; 64][..])).is_err()); assert!(PublicKey::read_from(&mut &[0; 65][..]).is_err());
assert!(PublicKey::read_from(&mut &[4; 64][..]).is_err());
} }
#[test] #[test]