Update clippy MSRV configuration

We've upgraded MSRV but didn't update clippy config, so some things that
could be improved aren't caught by clippy. This updates the config and
fixes the new issues.

I also `rg '1\.41\.1'`ed for interesting changes and found one
additional improvement.
This commit is contained in:
Martin Habovstiak 2023-04-02 16:25:09 +02:00
parent c7f970d8dc
commit 8b4280d5ef
5 changed files with 8 additions and 15 deletions

View File

@ -1020,10 +1020,10 @@ impl Address<NetworkUnchecked> {
/// assert_eq!(address.is_valid_for_network(Network::Testnet), false); /// assert_eq!(address.is_valid_for_network(Network::Testnet), false);
/// ``` /// ```
pub fn is_valid_for_network(&self, network: Network) -> bool { pub fn is_valid_for_network(&self, network: Network) -> bool {
let is_legacy = match self.address_type_internal() { let is_legacy = matches!(
Some(AddressType::P2pkh) | Some(AddressType::P2sh) => true, self.address_type_internal(),
_ => false, Some(AddressType::P2pkh) | Some(AddressType::P2sh)
}; );
match (self.network, network) { match (self.network, network) {
(a, b) if a == b => true, (a, b) if a == b => true,

View File

@ -62,10 +62,8 @@ impl LockTime {
pub fn is_satisfied_by(&self, h: Height, t: Time) -> bool { pub fn is_satisfied_by(&self, h: Height, t: Time) -> bool {
if let Ok(true) = self.is_satisfied_by_height(h) { if let Ok(true) = self.is_satisfied_by_height(h) {
true true
} else if let Ok(true) = self.is_satisfied_by_time(t) {
true
} else { } else {
false matches!(self.is_satisfied_by_time(t), Ok(true))
} }
} }

View File

@ -359,10 +359,7 @@ mod test {
]); ]);
assert!(addr.is_ok()); assert!(addr.is_ok());
let full = addr.unwrap(); let full = addr.unwrap();
assert!(match full.socket_addr().unwrap() { assert!(matches!(full.socket_addr().unwrap(), SocketAddr::V4(_)));
SocketAddr::V4(_) => true,
_ => false,
});
assert_eq!(full.services, ServiceFlags::NETWORK); assert_eq!(full.services, ServiceFlags::NETWORK);
assert_eq!(full.address, [0, 0, 0, 0, 0, 0xffff, 0x0a00, 0x0001]); assert_eq!(full.address, [0, 0, 0, 0, 0, 0xffff, 0x0a00, 0x0001]);
assert_eq!(full.port, 8333); assert_eq!(full.port, 8333);

View File

@ -50,9 +50,7 @@ fn serde_regression_block() {
); );
let block: Block = deserialize(segwit).unwrap(); let block: Block = deserialize(segwit).unwrap();
let got = serialize(&block).unwrap(); let got = serialize(&block).unwrap();
// The cast is required because Rust 1.41.1 throws the following error without it: let want = include_bytes!("data/serde/block_bincode");
// the trait `std::array::LengthAtMost32` is not implemented for `[u8; 5123]`
let want = include_bytes!("data/serde/block_bincode") as &[_];
assert_eq!(got, want) assert_eq!(got, want)
} }

View File

@ -1 +1 @@
msrv = "1.41.1" msrv = "1.48.0"