From fbc7aa7fd539853ccfa2db62190a3b6dd8b899fa Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 15 Oct 2024 14:02:56 +0100 Subject: [PATCH 1/2] Remove unnecessary lifetimes New lint warnings from recent nightly toolchain show some explicit lifetimes that can be omitted. The unnecessary lifetimes have been removed. --- io/src/lib.rs | 8 ++++---- units/src/fee_rate.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/io/src/lib.rs b/io/src/lib.rs index 387fbdffb..cc88838fa 100644 --- a/io/src/lib.rs +++ b/io/src/lib.rs @@ -98,7 +98,7 @@ pub struct Take<'a, R: Read + ?Sized> { remaining: u64, } -impl<'a, R: Read + ?Sized> Take<'a, R> { +impl Take<'_, R> { /// Reads all bytes until EOF from the underlying reader into `buf`. #[cfg(feature = "alloc")] #[inline] @@ -120,7 +120,7 @@ impl<'a, R: Read + ?Sized> Take<'a, R> { } } -impl<'a, R: Read + ?Sized> Read for Take<'a, R> { +impl Read for Take<'_, R> { #[inline] fn read(&mut self, buf: &mut [u8]) -> Result { let len = cmp::min(buf.len(), self.remaining.try_into().unwrap_or(buf.len())); @@ -131,7 +131,7 @@ impl<'a, R: Read + ?Sized> Read for Take<'a, R> { } // Impl copied from Rust stdlib. -impl<'a, R: BufRead + ?Sized> BufRead for Take<'a, R> { +impl BufRead for Take<'_, R> { #[inline] fn fill_buf(&mut self) -> Result<&[u8]> { // Don't call into inner reader at all at EOF because it may still block @@ -299,7 +299,7 @@ impl Write for alloc::vec::Vec { fn flush(&mut self) -> Result<()> { Ok(()) } } -impl<'a> Write for &'a mut [u8] { +impl Write for &mut [u8] { #[inline] fn write(&mut self, buf: &[u8]) -> Result { let cnt = core::cmp::min(self.len(), buf.len()); diff --git a/units/src/fee_rate.rs b/units/src/fee_rate.rs index e01a640a1..237de0f5b 100644 --- a/units/src/fee_rate.rs +++ b/units/src/fee_rate.rs @@ -163,7 +163,7 @@ impl Add<&FeeRate> for FeeRate { fn add(self, other: &FeeRate) -> ::Output { FeeRate(self.0 + other.0) } } -impl<'a, 'b> Add<&'a FeeRate> for &'b FeeRate { +impl<'a> Add<&'a FeeRate> for &FeeRate { type Output = FeeRate; fn add(self, other: &'a FeeRate) -> ::Output { FeeRate(self.0 + other.0) } @@ -187,7 +187,7 @@ impl Sub<&FeeRate> for FeeRate { fn sub(self, other: &FeeRate) -> ::Output { FeeRate(self.0 - other.0) } } -impl<'a, 'b> Sub<&'a FeeRate> for &'b FeeRate { +impl<'a> Sub<&'a FeeRate> for &FeeRate { type Output = FeeRate; fn sub(self, other: &'a FeeRate) -> ::Output { FeeRate(self.0 - other.0) } From 8696cb4b077b5a05084713784ece694cc540c7d4 Mon Sep 17 00:00:00 2001 From: "Jamil Lambert, PhD" Date: Tue, 15 Oct 2024 14:05:19 +0100 Subject: [PATCH 2/2] Fix unused import warning An import was only used behind a feature gate. The feature gate has been added to the use statement to remove the warning. --- bitcoin/src/sign_message.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/bitcoin/src/sign_message.rs b/bitcoin/src/sign_message.rs index dc2e6db34..baf9ce1de 100644 --- a/bitcoin/src/sign_message.rs +++ b/bitcoin/src/sign_message.rs @@ -6,6 +6,7 @@ //! library is used with the `secp-recovery` feature. use hashes::{sha256d, HashEngine}; +#[cfg(feature = "secp-recovery")] use secp256k1::SecretKey; use crate::consensus::encode::WriteExt;