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);
/// ```
pub fn is_valid_for_network(&self, network: Network) -> bool {
let is_legacy = match self.address_type_internal() {
Some(AddressType::P2pkh) | Some(AddressType::P2sh) => true,
_ => false,
};
let is_legacy = matches!(
self.address_type_internal(),
Some(AddressType::P2pkh) | Some(AddressType::P2sh)
);
match (self.network, network) {
(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 {
if let Ok(true) = self.is_satisfied_by_height(h) {
true
} else if let Ok(true) = self.is_satisfied_by_time(t) {
true
} else {
false
matches!(self.is_satisfied_by_time(t), Ok(true))
}
}

View File

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

View File

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

View File

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