From 0098582d3fc38cc07c9c09ac64f552e5d731cd24 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 30 Dec 2024 09:49:14 +1100 Subject: [PATCH] Update nightly-version file The `nightly-version` file is 3 months old. We don't really have an update policy but it seems like 3 months is old enough. Grab the current version from `rust-bitcoin` and fix all the "lifetime can be elided" errors. --- examples/custom.rs | 8 ++++---- fuzz/fuzz_targets/encode.rs | 6 +++--- nightly-version | 2 +- src/display.rs | 18 +++++++++--------- src/iter.rs | 8 ++++---- src/serde.rs | 8 ++++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/examples/custom.rs b/examples/custom.rs index 0fc77f1..f6a5e7a 100644 --- a/examples/custom.rs +++ b/examples/custom.rs @@ -93,21 +93,21 @@ pub struct DisplayALittleBitHexy<'a> { data: &'a [u8], } -impl<'a> fmt::Display for DisplayALittleBitHexy<'a> { +impl fmt::Display for DisplayALittleBitHexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a> fmt::Debug for DisplayALittleBitHexy<'a> { +impl fmt::Debug for DisplayALittleBitHexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a> fmt::LowerHex for DisplayALittleBitHexy<'a> { +impl fmt::LowerHex for DisplayALittleBitHexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(&self.data.as_hex(), f) } } -impl<'a> fmt::UpperHex for DisplayALittleBitHexy<'a> { +impl fmt::UpperHex for DisplayALittleBitHexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::UpperHex::fmt(&self.data.as_hex(), f) } diff --git a/fuzz/fuzz_targets/encode.rs b/fuzz/fuzz_targets/encode.rs index 431bfce..3962449 100644 --- a/fuzz/fuzz_targets/encode.rs +++ b/fuzz/fuzz_targets/encode.rs @@ -9,18 +9,18 @@ pub struct Hexy<'s> { data: &'s [u8], } -impl<'s> Hexy<'s> { +impl Hexy<'_> { /// Demonstrates getting internal opaque data as a byte slice. pub fn as_bytes(&self) -> &[u8] { self.data } } -impl<'s> fmt::LowerHex for Hexy<'s> { +impl fmt::LowerHex for Hexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(&self.data.as_hex(), f) } } -impl<'s> fmt::UpperHex for Hexy<'s> { +impl fmt::UpperHex for Hexy<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::UpperHex::fmt(&self.data.as_hex(), f) } diff --git a/nightly-version b/nightly-version index b8be08f..5de8e30 100644 --- a/nightly-version +++ b/nightly-version @@ -1 +1 @@ -nightly-2024-09-18 +nightly-2024-12-26 diff --git a/src/display.rs b/src/display.rs index 79bc87a..91f04fb 100644 --- a/src/display.rs +++ b/src/display.rs @@ -248,25 +248,25 @@ pub struct DisplayByteSlice<'a> { pub(crate) bytes: &'a [u8], } -impl<'a> DisplayByteSlice<'a> { +impl DisplayByteSlice<'_> { fn display(&self, f: &mut fmt::Formatter, case: Case) -> fmt::Result { internal_display(self.bytes, f, case) } } -impl<'a> fmt::Display for DisplayByteSlice<'a> { +impl fmt::Display for DisplayByteSlice<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a> fmt::Debug for DisplayByteSlice<'a> { +impl fmt::Debug for DisplayByteSlice<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a> fmt::LowerHex for DisplayByteSlice<'a> { +impl fmt::LowerHex for DisplayByteSlice<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.display(f, Case::Lower) } } -impl<'a> fmt::UpperHex for DisplayByteSlice<'a> { +impl fmt::UpperHex for DisplayByteSlice<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.display(f, Case::Upper) } } @@ -294,19 +294,19 @@ impl<'a, const CAP: usize> DisplayArray<'a, CAP> { } } -impl<'a, const LEN: usize> fmt::Display for DisplayArray<'a, LEN> { +impl fmt::Display for DisplayArray<'_, LEN> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a, const LEN: usize> fmt::Debug for DisplayArray<'a, LEN> { +impl fmt::Debug for DisplayArray<'_, LEN> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } -impl<'a, const LEN: usize> fmt::LowerHex for DisplayArray<'a, LEN> { +impl fmt::LowerHex for DisplayArray<'_, LEN> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.display(f, Case::Lower) } } -impl<'a, const LEN: usize> fmt::UpperHex for DisplayArray<'a, LEN> { +impl fmt::UpperHex for DisplayArray<'_, LEN> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { self.display(f, Case::Upper) } } diff --git a/src/iter.rs b/src/iter.rs index c18e847..adfab0c 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -193,7 +193,7 @@ impl<'a> HexDigitsIter<'a> { fn new_unchecked(digits: &'a [u8]) -> Self { Self { iter: digits.chunks_exact(2) } } } -impl<'a> Iterator for HexDigitsIter<'a> { +impl Iterator for HexDigitsIter<'_> { type Item = [u8; 2]; #[inline] @@ -210,7 +210,7 @@ impl<'a> Iterator for HexDigitsIter<'a> { } } -impl<'a> DoubleEndedIterator for HexDigitsIter<'a> { +impl DoubleEndedIterator for HexDigitsIter<'_> { #[inline] fn next_back(&mut self) -> Option { self.iter.next_back().map(|digits| digits.try_into().expect("HexDigitsIter invariant")) @@ -222,9 +222,9 @@ impl<'a> DoubleEndedIterator for HexDigitsIter<'a> { } } -impl<'a> ExactSizeIterator for HexDigitsIter<'a> {} +impl ExactSizeIterator for HexDigitsIter<'_> {} -impl<'a> core::iter::FusedIterator for HexDigitsIter<'a> {} +impl core::iter::FusedIterator for HexDigitsIter<'_> {} /// `hi` and `lo` are bytes representing hex characters. /// diff --git a/src/serde.rs b/src/serde.rs index a558cb1..7a9251c 100644 --- a/src/serde.rs +++ b/src/serde.rs @@ -74,7 +74,7 @@ where /// Byte slice wrapper to serialize as a hex string in lowercase characters. pub struct SerializeBytesAsHex<'a>(pub &'a [u8]); -impl<'a> serde::Serialize for SerializeBytesAsHex<'a> { +impl serde::Serialize for SerializeBytesAsHex<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -86,7 +86,7 @@ impl<'a> serde::Serialize for SerializeBytesAsHex<'a> { /// Byte slice wrapper to serialize as a hex string in lowercase characters. pub struct SerializeBytesAsHexLower<'a>(pub &'a [u8]); -impl<'a> serde::Serialize for SerializeBytesAsHexLower<'a> { +impl serde::Serialize for SerializeBytesAsHexLower<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -98,7 +98,7 @@ impl<'a> serde::Serialize for SerializeBytesAsHexLower<'a> { /// Byte slice wrapper to serialize as a hex string in uppercase characters. pub struct SerializeBytesAsHexUpper<'a>(pub &'a [u8]); -impl<'a> serde::Serialize for SerializeBytesAsHexUpper<'a> { +impl serde::Serialize for SerializeBytesAsHexUpper<'_> { fn serialize(&self, serializer: S) -> Result where S: serde::Serializer, @@ -120,7 +120,7 @@ where { struct HexVisitor(PhantomData); - impl<'de, T> Visitor<'de> for HexVisitor + impl Visitor<'_> for HexVisitor where T: FromHex, {