Elide more lifetimes
clippy found some more lifetimes to elide.
This commit is contained in:
parent
2edfcedde1
commit
3e2c43b19e
|
@ -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> {
|
||||
|
|
|
@ -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.
|
||||
///
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1 +1 @@
|
|||
nightly-2024-09-29
|
||||
nightly-2024-10-27
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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>;
|
||||
|
|
Loading…
Reference in New Issue