Merge rust-bitcoin/rust-bitcoin#1774: Update clippy MSRV configuration

8b4280d5ef Update clippy MSRV configuration (Martin Habovstiak)

Pull request description:

  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.

ACKs for top commit:
  apoelstra:
    ACK 8b4280d5ef
  tcharding:
    ACK 8b4280d5ef

Tree-SHA512: 337ca099ca1a4b8b5d230c802bc455a5e0bbc3436066e41577c5b67f8d7fedede6f7a446b208da067ffc2cc2cebcbc187404846c295e9d89798f11dc66d34e34
This commit is contained in:
Andrew Poelstra 2023-04-03 13:09:18 +00:00
commit f34f308f4b
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
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"