Fix clippy lints.

This commit is contained in:
Kris Nuttycombe 2021-12-03 14:21:40 -07:00
parent 76082e4287
commit a6420858f4
3 changed files with 21 additions and 21 deletions

View File

@ -190,7 +190,7 @@ mod tests {
0x7b, 0x28, 0x69, 0xc9, 0x84,
];
assert_eq!(
Address::parse_items(&Address::MAINNET, &invalid_padding[..]),
Address::parse_items(Address::MAINNET, &invalid_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -205,7 +205,7 @@ mod tests {
0x4b, 0x31, 0xee, 0x5a,
];
assert_eq!(
Address::parse_items(&Address::MAINNET, &truncated_padding[..]),
Address::parse_items(Address::MAINNET, &truncated_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -230,7 +230,7 @@ mod tests {
0xc6, 0x5e, 0x68, 0xa2, 0x78, 0x6c, 0x9e,
];
assert_matches!(
Address::parse_items(&Address::MAINNET, &truncated_sapling_data[..]),
Address::parse_items(Address::MAINNET, &truncated_sapling_data[..]),
Err(ParseError::InvalidEncoding(_))
);
@ -243,7 +243,7 @@ mod tests {
0xe6, 0x70, 0x36, 0x5b, 0x7b, 0x9e,
];
assert_matches!(
Address::parse_items(&Address::MAINNET, &truncated_after_sapling_typecode[..]),
Address::parse_items(Address::MAINNET, &truncated_after_sapling_typecode[..]),
Err(ParseError::InvalidEncoding(_))
);
}
@ -253,9 +253,9 @@ mod tests {
// Construct and serialize an invalid UA. This must be done using private
// methods, as the public API does not permit construction of such invalid values.
let ua = Address(vec![Receiver::Sapling([1; 43]), Receiver::Sapling([2; 43])]);
let encoded = ua.to_jumbled_bytes(&Address::MAINNET);
let encoded = ua.to_jumbled_bytes(Address::MAINNET);
assert_eq!(
Address::parse_items(&Address::MAINNET, &encoded[..]).and_then(Address::try_from_items),
Address::parse_items(Address::MAINNET, &encoded[..]).and_then(Address::try_from_items),
Err(ParseError::DuplicateTypecode(Typecode::Sapling))
);
}
@ -265,10 +265,10 @@ mod tests {
// Construct and serialize an invalid UA. This must be done using private
// methods, as the public API does not permit construction of such invalid values.
let ua = Address(vec![Receiver::P2pkh([0; 20]), Receiver::P2sh([0; 20])]);
let encoded = ua.to_jumbled_bytes(&Address::MAINNET);
let encoded = ua.to_jumbled_bytes(Address::MAINNET);
// ensure that decoding catches the error
assert_eq!(
Address::parse_items(&Address::MAINNET, &encoded[..]).and_then(Address::try_from_items),
Address::parse_items(Address::MAINNET, &encoded[..]).and_then(Address::try_from_items),
Err(ParseError::BothP2phkAndP2sh)
);
}
@ -287,7 +287,7 @@ mod tests {
// with only one of them we don't have sufficient data for F4Jumble (so we hit a
// different error).
assert_matches!(
Address::parse_items(&Address::MAINNET, &encoded[..]),
Address::parse_items(Address::MAINNET, &encoded[..]),
Err(ParseError::InvalidEncoding(_))
);
}

View File

@ -230,7 +230,7 @@ mod tests {
0xdf, 0x63, 0xe7, 0xef, 0x65, 0x6b, 0x18, 0x23, 0xf7, 0x3e, 0x35, 0x7c, 0xf3, 0xc4,
];
assert_eq!(
Ufvk::parse_items(&Ufvk::MAINNET, &invalid_padding[..]),
Ufvk::parse_items(Ufvk::MAINNET, &invalid_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -248,7 +248,7 @@ mod tests {
0x43, 0x8e, 0xc0, 0x3e, 0x9f, 0xf4, 0xf1, 0x80, 0x32, 0xcf, 0x2f, 0x7e, 0x7f, 0x91,
];
assert_eq!(
Ufvk::parse_items(&Ufvk::MAINNET, &truncated_padding[..]),
Ufvk::parse_items(Ufvk::MAINNET, &truncated_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -280,7 +280,7 @@ mod tests {
0x8c, 0x7a, 0xbf, 0x7b, 0x9a, 0xdd, 0xee, 0x18, 0x2c, 0x2d, 0xc2, 0xfc,
];
assert_matches!(
Ufvk::parse_items(&Ufvk::MAINNET, &truncated_sapling_data[..]),
Ufvk::parse_items(Ufvk::MAINNET, &truncated_sapling_data[..]),
Err(ParseError::InvalidEncoding(_))
);
@ -295,7 +295,7 @@ mod tests {
0x54, 0xd1, 0x9e, 0xec, 0x8b, 0xef, 0x35, 0xb8, 0x44, 0xdd, 0xab, 0x9a, 0x8d,
];
assert_matches!(
Ufvk::parse_items(&Ufvk::MAINNET, &truncated_after_sapling_typecode[..]),
Ufvk::parse_items(Ufvk::MAINNET, &truncated_after_sapling_typecode[..]),
Err(ParseError::InvalidEncoding(_))
);
}
@ -305,9 +305,9 @@ mod tests {
// Construct and serialize an invalid Ufvk. This must be done using private
// methods, as the public API does not permit construction of such invalid values.
let ufvk = Ufvk(vec![Fvk::Sapling([1; 128]), Fvk::Sapling([2; 128])]);
let encoded = ufvk.to_jumbled_bytes(&Ufvk::MAINNET);
let encoded = ufvk.to_jumbled_bytes(Ufvk::MAINNET);
assert_eq!(
Ufvk::parse_items(&Ufvk::MAINNET, &encoded[..]).and_then(Ufvk::try_from_items),
Ufvk::parse_items(Ufvk::MAINNET, &encoded[..]).and_then(Ufvk::try_from_items),
Err(ParseError::DuplicateTypecode(Typecode::Sapling))
);
}
@ -325,7 +325,7 @@ mod tests {
];
assert_eq!(
Ufvk::parse_items(&Ufvk::MAINNET, &encoded[..]).and_then(Ufvk::try_from_items),
Ufvk::parse_items(Ufvk::MAINNET, &encoded[..]).and_then(Ufvk::try_from_items),
Err(ParseError::OnlyTransparent)
);
}

View File

@ -223,7 +223,7 @@ mod tests {
0x83, 0xe8, 0x92, 0x18, 0x28, 0x70, 0x1e, 0x81, 0x76, 0x56, 0xb6, 0x15,
];
assert_eq!(
Uivk::parse_items(&Uivk::MAINNET, &invalid_padding[..]),
Uivk::parse_items(Uivk::MAINNET, &invalid_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -239,7 +239,7 @@ mod tests {
0xf9, 0x65, 0x49, 0x14, 0xab, 0x7c, 0x55, 0x7b, 0x39, 0x47,
];
assert_eq!(
Uivk::parse_items(&Uivk::MAINNET, &truncated_padding[..]),
Uivk::parse_items(Uivk::MAINNET, &truncated_padding[..]),
Err(ParseError::InvalidEncoding(
"Invalid padding bytes".to_owned()
))
@ -267,7 +267,7 @@ mod tests {
0xf5, 0xd5, 0x8a, 0xb5, 0x1a,
];
assert_matches!(
Uivk::parse_items(&Uivk::MAINNET, &truncated_sapling_data[..]),
Uivk::parse_items(Uivk::MAINNET, &truncated_sapling_data[..]),
Err(ParseError::InvalidEncoding(_))
);
@ -280,7 +280,7 @@ mod tests {
0xd8, 0x21, 0x5e, 0x8, 0xa, 0x82, 0x95, 0x21, 0x74,
];
assert_matches!(
Uivk::parse_items(&Uivk::MAINNET, &truncated_after_sapling_typecode[..]),
Uivk::parse_items(Uivk::MAINNET, &truncated_after_sapling_typecode[..]),
Err(ParseError::InvalidEncoding(_))
);
}
@ -309,7 +309,7 @@ mod tests {
];
assert_eq!(
Uivk::parse_items(&Uivk::MAINNET, &encoded[..]).and_then(Uivk::try_from_items),
Uivk::parse_items(Uivk::MAINNET, &encoded[..]).and_then(Uivk::try_from_items),
Err(ParseError::OnlyTransparent)
);
}