Merge rust-bitcoin/rust-bitcoin#3473: Fix lint errors
8696cb4b07
Fix unused import warning (Jamil Lambert, PhD)fbc7aa7fd5
Remove unnecessary lifetimes (Jamil Lambert, PhD) Pull request description: New lint warnings from a recent nightly toolchain show some explicit lifetimes that can be omitted. The unnecessary lifetimes have been removed. An unused import warning has also been fixed by placing the use statement behind the relevant feature gate. ACKs for top commit: tcharding: ACK8696cb4b07
apoelstra: ACK8696cb4b07
successfully ran local tests Tree-SHA512: 37e14ca9be2e8cfa64498084a7363783c2cca92dfce40a0a3ed9bda98f081c1fa9119e5d49d81684b6968329945c7004b86534412fd2fcd4898b862c859d42c6
This commit is contained in:
commit
84deb29964
|
@ -6,6 +6,7 @@
|
||||||
//! library is used with the `secp-recovery` feature.
|
//! library is used with the `secp-recovery` feature.
|
||||||
|
|
||||||
use hashes::{sha256d, HashEngine};
|
use hashes::{sha256d, HashEngine};
|
||||||
|
#[cfg(feature = "secp-recovery")]
|
||||||
use secp256k1::SecretKey;
|
use secp256k1::SecretKey;
|
||||||
|
|
||||||
use crate::consensus::encode::WriteExt;
|
use crate::consensus::encode::WriteExt;
|
||||||
|
|
|
@ -98,7 +98,7 @@ pub struct Take<'a, R: Read + ?Sized> {
|
||||||
remaining: u64,
|
remaining: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: Read + ?Sized> Take<'a, R> {
|
impl<R: Read + ?Sized> Take<'_, R> {
|
||||||
/// Reads all bytes until EOF from the underlying reader into `buf`.
|
/// Reads all bytes until EOF from the underlying reader into `buf`.
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -120,7 +120,7 @@ impl<'a, R: Read + ?Sized> Take<'a, R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, R: Read + ?Sized> Read for Take<'a, R> {
|
impl<R: Read + ?Sized> Read for Take<'_, R> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
fn read(&mut self, buf: &mut [u8]) -> Result<usize> {
|
||||||
let len = cmp::min(buf.len(), self.remaining.try_into().unwrap_or(buf.len()));
|
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 copied from Rust stdlib.
|
||||||
impl<'a, R: BufRead + ?Sized> BufRead for Take<'a, R> {
|
impl<R: BufRead + ?Sized> BufRead for Take<'_, R> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fill_buf(&mut self) -> Result<&[u8]> {
|
fn fill_buf(&mut self) -> Result<&[u8]> {
|
||||||
// Don't call into inner reader at all at EOF because it may still block
|
// 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<u8> {
|
||||||
fn flush(&mut self) -> Result<()> { Ok(()) }
|
fn flush(&mut self) -> Result<()> { Ok(()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Write for &'a mut [u8] {
|
impl Write for &mut [u8] {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write(&mut self, buf: &[u8]) -> Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> Result<usize> {
|
||||||
let cnt = core::cmp::min(self.len(), buf.len());
|
let cnt = core::cmp::min(self.len(), buf.len());
|
||||||
|
|
|
@ -163,7 +163,7 @@ impl Add<&FeeRate> for FeeRate {
|
||||||
fn add(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
fn add(self, other: &FeeRate) -> <FeeRate as Add>::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;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
fn add(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 + other.0) }
|
||||||
|
@ -187,7 +187,7 @@ impl Sub<&FeeRate> for FeeRate {
|
||||||
fn sub(self, other: &FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
fn sub(self, other: &FeeRate) -> <FeeRate as Add>::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;
|
type Output = FeeRate;
|
||||||
|
|
||||||
fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
fn sub(self, other: &'a FeeRate) -> <FeeRate as Add>::Output { FeeRate(self.0 - other.0) }
|
||||||
|
|
Loading…
Reference in New Issue