3e2c43b19e Elide more lifetimes (Tobin C. Harding)

Pull request description:

  clippy found some more lifetimes to elide.

ACKs for top commit:
  jamillambert:
    ACK 3e2c43b19e
  apoelstra:
    ACK 3e2c43b19e111ee58fb280232e084ea40263040b; successfully ran local tests

Tree-SHA512: 4ad27794f67e1fa42a17830983fc124d53aff3f9c31a0b37760f6fa674cc0bf01b1f0d2861fb953a1c9e7507d45078ff6408e9ee203dab0171bfded10409a6a3
This commit is contained in:
merge-script 2024-10-28 16:07:37 +00:00
commit 20479f199f
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
17 changed files with 39 additions and 39 deletions

View File

@ -296,7 +296,7 @@ impl IntoDerivationPath for String {
fn into_derivation_path(self) -> Result<DerivationPath, Error> { self.parse() }
}
impl<'a> IntoDerivationPath for &'a str {
impl IntoDerivationPath for &'_ str {
fn into_derivation_path(self) -> Result<DerivationPath, Error> { self.parse() }
}
@ -363,7 +363,7 @@ impl<'a> DerivationPathIterator<'a> {
}
}
impl<'a> Iterator for DerivationPathIterator<'a> {
impl Iterator for DerivationPathIterator<'_> {
type Item = DerivationPath;
fn next(&mut self) -> Option<Self::Item> {

View File

@ -14,7 +14,7 @@ pub enum Instruction<'a> {
Op(Opcode),
}
impl<'a> Instruction<'a> {
impl Instruction<'_> {
/// Returns the opcode if the instruction is not a data push.
pub fn opcode(&self) -> Option<Opcode> {
match self {
@ -200,7 +200,7 @@ impl<'a> Iterator for Instructions<'a> {
}
}
impl<'a> core::iter::FusedIterator for Instructions<'a> {}
impl core::iter::FusedIterator for Instructions<'_> {}
/// Iterator over script instructions with their positions.
///

View File

@ -207,17 +207,17 @@ impl<'a> Extend<Instruction<'a>> for ScriptBuf {
/// leaks, which is OK since we never leak.)
pub(crate) struct ScriptBufAsVec<'a>(&'a mut ScriptBuf, Vec<u8>);
impl<'a> core::ops::Deref for ScriptBufAsVec<'a> {
impl core::ops::Deref for ScriptBufAsVec<'_> {
type Target = Vec<u8>;
fn deref(&self) -> &Self::Target { &self.1 }
}
impl<'a> core::ops::DerefMut for ScriptBufAsVec<'a> {
impl core::ops::DerefMut for ScriptBufAsVec<'_> {
fn deref_mut(&mut self) -> &mut Self::Target { &mut self.1 }
}
impl<'a> Drop for ScriptBufAsVec<'a> {
impl Drop for ScriptBufAsVec<'_> {
fn drop(&mut self) {
let vec = core::mem::take(&mut self.1);
*(self.0) = ScriptBuf::from_bytes(vec);

View File

@ -128,7 +128,7 @@ impl TryFrom<Opcode> for WitnessVersion {
}
}
impl<'a> TryFrom<Instruction<'a>> for WitnessVersion {
impl TryFrom<Instruction<'_>> for WitnessVersion {
type Error = TryFromInstructionError;
fn try_from(instruction: Instruction) -> Result<Self, Self::Error> {

View File

@ -663,13 +663,13 @@ impl Decodable for CheckedData {
}
}
impl<'a, T: Encodable> Encodable for &'a T {
impl<T: Encodable> Encodable for &'_ T {
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
(**self).consensus_encode(w)
}
}
impl<'a, T: Encodable> Encodable for &'a mut T {
impl<T: Encodable> Encodable for &'_ mut T {
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
(**self).consensus_encode(w)
}

View File

@ -117,7 +117,7 @@ pub mod hex {
}
}
impl<'a> Iterator for Decoder<'a> {
impl Iterator for Decoder<'_> {
type Item = Result<u8, DecodeError>;
fn next(&mut self) -> Option<Self::Item> {
@ -262,7 +262,7 @@ impl<'a, W: fmt::Write, E: EncodeBytes> IoWrapper<'a, W, E> {
fn actually_flush(&mut self) -> fmt::Result { self.encoder.flush(&mut self.writer) }
}
impl<'a, W: fmt::Write, E: EncodeBytes> Write for IoWrapper<'a, W, E> {
impl<W: fmt::Write, E: EncodeBytes> Write for IoWrapper<'_, W, E> {
fn write(&mut self, bytes: &[u8]) -> io::Result<usize> {
match self.encoder.encode_chunk(&mut self.writer, bytes) {
Ok(()) => Ok(bytes.len()),
@ -473,7 +473,7 @@ impl<E> With<E> {
struct HRVisitor<T: Decodable, D: for<'a> ByteDecoder<'a>>(PhantomData<fn() -> (T, D)>);
impl<'de, T: Decodable, D: for<'a> ByteDecoder<'a>> Visitor<'de> for HRVisitor<T, D> {
impl<T: Decodable, D: for<'a> ByteDecoder<'a>> Visitor<'_> for HRVisitor<T, D> {
type Value = T;
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {

View File

@ -531,7 +531,7 @@ impl<'de> serde::Deserialize<'de> for PrivateKey {
fn deserialize<D: serde::Deserializer<'de>>(d: D) -> Result<PrivateKey, D::Error> {
struct WifVisitor;
impl<'de> serde::de::Visitor<'de> for WifVisitor {
impl serde::de::Visitor<'_> for WifVisitor {
type Value = PrivateKey;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
@ -579,7 +579,7 @@ impl<'de> serde::Deserialize<'de> for PublicKey {
if d.is_human_readable() {
struct HexVisitor;
impl<'de> serde::de::Visitor<'de> for HexVisitor {
impl serde::de::Visitor<'_> for HexVisitor {
type Value = PublicKey;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
@ -608,7 +608,7 @@ impl<'de> serde::Deserialize<'de> for PublicKey {
} else {
struct BytesVisitor;
impl<'de> serde::de::Visitor<'de> for BytesVisitor {
impl serde::de::Visitor<'_> for BytesVisitor {
type Value = PublicKey;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
@ -645,7 +645,7 @@ impl<'de> serde::Deserialize<'de> for CompressedPublicKey {
if d.is_human_readable() {
struct HexVisitor;
impl<'de> serde::de::Visitor<'de> for HexVisitor {
impl serde::de::Visitor<'_> for HexVisitor {
type Value = CompressedPublicKey;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {
@ -674,7 +674,7 @@ impl<'de> serde::Deserialize<'de> for CompressedPublicKey {
} else {
struct BytesVisitor;
impl<'de> serde::de::Visitor<'de> for BytesVisitor {
impl serde::de::Visitor<'_> for BytesVisitor {
type Value = CompressedPublicKey;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {

View File

@ -215,7 +215,7 @@ impl str::FromStr for TapSighashType {
}
}
impl<'u, T> Prevouts<'u, T>
impl<T> Prevouts<'_, T>
where
T: Borrow<TxOut>,
{
@ -1170,7 +1170,7 @@ impl<'a> Annex<'a> {
pub fn as_bytes(&self) -> &[u8] { self.0 }
}
impl<'a> Encodable for Annex<'a> {
impl Encodable for Annex<'_> {
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
encode::consensus_encode_with_size(self.0, w)
}

View File

@ -104,7 +104,7 @@ impl<'de> Deserialize<'de> for Network {
{
struct NetworkVisitor;
impl<'de> Visitor<'de> for NetworkVisitor {
impl Visitor<'_> for NetworkVisitor {
type Value = Network;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
@ -265,7 +265,7 @@ pub mod as_core_arg {
{
struct NetworkVisitor;
impl<'de> serde::de::Visitor<'de> for NetworkVisitor {
impl serde::de::Visitor<'_> for NetworkVisitor {
type Value = Network;
fn visit_str<E: serde::de::Error>(self, s: &str) -> Result<Self::Value, E> {

View File

@ -334,7 +334,7 @@ impl RawNetworkMessage {
struct HeaderSerializationWrapper<'a>(&'a Vec<block::Header>);
impl<'a> Encodable for HeaderSerializationWrapper<'a> {
impl Encodable for HeaderSerializationWrapper<'_> {
#[inline]
fn consensus_encode<W: Write + ?Sized>(&self, w: &mut W) -> Result<usize, io::Error> {
let mut len = 0;

View File

@ -996,7 +996,7 @@ impl<'de> crate::serde::Deserialize<'de> for U256 {
if d.is_human_readable() {
struct HexVisitor;
impl<'de> de::Visitor<'de> for HexVisitor {
impl de::Visitor<'_> for HexVisitor {
type Value = U256;
fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -1036,7 +1036,7 @@ impl<'de> crate::serde::Deserialize<'de> for U256 {
} else {
struct BytesVisitor;
impl<'de> serde::de::Visitor<'de> for BytesVisitor {
impl serde::de::Visitor<'_> for BytesVisitor {
type Value = U256;
fn expecting(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {

View File

@ -6,7 +6,7 @@
pub(crate) struct SerializeBytesAsHex<'a>(pub(crate) &'a [u8]);
impl<'a> serde::Serialize for SerializeBytesAsHex<'a> {
impl serde::Serialize for SerializeBytesAsHex<'_> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
@ -262,7 +262,7 @@ pub mod hex_bytes {
{
struct Visitor<B>(core::marker::PhantomData<B>);
impl<'de, B: FromHex> serde::de::Visitor<'de> for Visitor<B> {
impl<B: FromHex> serde::de::Visitor<'_> for Visitor<B> {
type Value = B;
fn expecting(&self, formatter: &mut core::fmt::Formatter) -> core::fmt::Result {

View File

@ -744,11 +744,11 @@ impl<'tree> Iterator for ScriptLeaves<'tree> {
fn size_hint(&self) -> (usize, Option<usize>) { self.leaf_iter.size_hint() }
}
impl<'tree> ExactSizeIterator for ScriptLeaves<'tree> {}
impl ExactSizeIterator for ScriptLeaves<'_> {}
impl<'tree> FusedIterator for ScriptLeaves<'tree> {}
impl FusedIterator for ScriptLeaves<'_> {}
impl<'tree> DoubleEndedIterator for ScriptLeaves<'tree> {
impl DoubleEndedIterator for ScriptLeaves<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> {
ScriptLeaf::from_leaf_node(self.leaf_iter.next_back()?)
@ -770,11 +770,11 @@ impl<'a> Iterator for LeafNodes<'a> {
fn size_hint(&self) -> (usize, Option<usize>) { self.leaf_iter.size_hint() }
}
impl<'tree> ExactSizeIterator for LeafNodes<'tree> {}
impl ExactSizeIterator for LeafNodes<'_> {}
impl<'tree> FusedIterator for LeafNodes<'tree> {}
impl FusedIterator for LeafNodes<'_> {}
impl<'tree> DoubleEndedIterator for LeafNodes<'tree> {
impl DoubleEndedIterator for LeafNodes<'_> {
#[inline]
fn next_back(&mut self) -> Option<Self::Item> { self.leaf_iter.next_back() }
}
@ -1277,7 +1277,7 @@ impl<'de> serde::Deserialize<'de> for LeafVersion {
D: serde::Deserializer<'de>,
{
struct U8Visitor;
impl<'de> serde::de::Visitor<'de> for U8Visitor {
impl serde::de::Visitor<'_> for U8Visitor {
type Value = LeafVersion;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {

View File

@ -1 +1 @@
nightly-2024-09-29
nightly-2024-10-27

View File

@ -360,7 +360,7 @@ impl<'de> serde::Deserialize<'de> for LockTime {
D: serde::Deserializer<'de>,
{
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
impl serde::de::Visitor<'_> for Visitor {
type Value = u32;
fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("a u32") }
// We cannot just implement visit_u32 because JSON (among other things) always

View File

@ -360,7 +360,7 @@ impl<'de> serde::Deserialize<'de> for ScriptBuf {
if deserializer.is_human_readable() {
struct Visitor;
impl<'de> serde::de::Visitor<'de> for Visitor {
impl serde::de::Visitor<'_> for Visitor {
type Value = ScriptBuf;
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
@ -379,7 +379,7 @@ impl<'de> serde::Deserialize<'de> for ScriptBuf {
} else {
struct BytesVisitor;
impl<'de> serde::de::Visitor<'de> for BytesVisitor {
impl serde::de::Visitor<'_> for BytesVisitor {
type Value = ScriptBuf;
fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {

View File

@ -327,7 +327,7 @@ impl<'a> Iterator for Iter<'a> {
}
}
impl<'a> ExactSizeIterator for Iter<'a> {}
impl ExactSizeIterator for Iter<'_> {}
impl<'a> IntoIterator for &'a Witness {
type IntoIter = Iter<'a>;