Skip to content

Commit

Permalink
cargo clippy -all-targets --all-features --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGould committed Dec 2, 2024
1 parent eae7202 commit 8745ec3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T
}
}

impl<'a, NetVal: NetworkValidation, T> Uri<'a, NetVal, T> {
impl<NetVal: NetworkValidation, T> Uri<'_, NetVal, T> {
/// Makes the lifetime `'static` by converting all fields to owned.
///
/// Note that this does **not** affect `extras`!
Expand Down Expand Up @@ -283,7 +283,7 @@ impl std::error::Error for UriError {
}

/// **Warning**: this implementation may needlessly allocate, consider using `TryFrom<&str>` instead.
impl<'a, T: for<'de> DeserializeParams<'de>> core::str::FromStr for Uri<'a, bitcoin::address::NetworkUnchecked, T> {
impl<T: for<'de> DeserializeParams<'de>> core::str::FromStr for Uri<'_, bitcoin::address::NetworkUnchecked, T> {
type Err = Error<T::Error>;

fn from_str(s: &str) -> Result<Self, Self::Err> {
Expand All @@ -300,7 +300,7 @@ impl<'a, T: DeserializeParams<'a>> TryFrom<&'a str> for Uri<'a, bitcoin::address
}

/// **Warning**: this implementation may needlessly allocate, consider using `TryFrom<&str>` instead.
impl<'a, T: for<'de> DeserializeParams<'de>> TryFrom<String> for Uri<'a, bitcoin::address::NetworkUnchecked, T> {
impl<T: for<'de> DeserializeParams<'de>> TryFrom<String> for Uri<'_, bitcoin::address::NetworkUnchecked, T> {
type Error = Error<T::Error>;

fn try_from(s: String) -> Result<Self, Self::Error> {
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ where
pub extras: Extras,
}

impl<'a, NetVal: NetworkValidation, T: Default> Uri<'a, NetVal, T> {
impl<NetVal: NetworkValidation, T: Default> Uri<'_, NetVal, T> {
/// Creates an URI with defaults.
///
/// This sets all fields except `address` to default values.
Expand All @@ -118,7 +118,7 @@ impl<'a, NetVal: NetworkValidation, T: Default> Uri<'a, NetVal, T> {
}
}

impl<'a, NetVal: NetworkValidation, T> Uri<'a, NetVal, T> {
impl<NetVal: NetworkValidation, T> Uri<'_, NetVal, T> {
/// Creates an URI with defaults.
///
/// This sets all fields except `address` and `extras` to default values.
Expand Down Expand Up @@ -194,7 +194,7 @@ impl<'a> From<&'a str> for Param<'a> {
}

/// Cheap conversion
impl<'a> From<String> for Param<'a> {
impl From<String> for Param<'_> {
fn from(value: String) -> Self {
Param(ParamInner::UnencodedString(Cow::Owned(value)))
}
Expand All @@ -212,7 +212,7 @@ impl<'a> From<&'a [u8]> for Param<'a> {
/// Cheap conversion
#[cfg(feature = "non-compliant-bytes")]
#[cfg_attr(docsrs, doc(cfg(feature = "non-compliant-bytes")))]
impl<'a> From<Vec<u8>> for Param<'a> {
impl From<Vec<u8>> for Param<'_> {
fn from(value: Vec<u8>) -> Self {
Param(ParamInner::UnencodedBytes(Cow::Owned(value)))
}
Expand Down Expand Up @@ -315,7 +315,7 @@ impl DeserializationError for NoExtras {
type Error = core::convert::Infallible;
}

impl<'de> DeserializationState<'de> for EmptyState {
impl DeserializationState<'_> for EmptyState {
type Value = NoExtras;

fn is_param_known(&self, _key: &str) -> bool {
Expand All @@ -331,7 +331,7 @@ impl<'de> DeserializationState<'de> for EmptyState {
}
}

impl<'a> SerializeParams for &'a NoExtras {
impl SerializeParams for &NoExtras {
type Key = core::convert::Infallible;
type Value = core::convert::Infallible;
type Iterator = core::iter::Empty<(Self::Key, Self::Value)>;
Expand Down
6 changes: 3 additions & 3 deletions src/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub trait SerializeParams {
/// Checks if the display implementation outputs `=` character.
struct EqSignChecker<'a, W: fmt::Write>(W, &'a dyn fmt::Display);

impl<'a, W: fmt::Write> fmt::Write for EqSignChecker<'a, W> {
impl<W: fmt::Write> fmt::Write for EqSignChecker<'_, W> {
fn write_str(&mut self, s: &str) -> fmt::Result {
if s.contains('=') {
panic!("key '{}' contains equal sign", self.1);
Expand Down Expand Up @@ -74,7 +74,7 @@ impl<T: fmt::Display> fmt::Display for DisplayEncoder<T> {
/// This is private because people should generally only display values as decoded
struct DisplayParam<'a>(&'a Param<'a>);

impl<'a> fmt::Display for DisplayParam<'a> {
impl fmt::Display for DisplayParam<'_> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match &(self.0).0 {
// TODO: improve percent_encoding_rfc_3986 so that allocation can be avoided
Expand Down Expand Up @@ -121,7 +121,7 @@ fn maybe_display_param(writer: &mut impl fmt::Write, key: impl fmt::Display, val

/// Formats QR-code-optimized URI if alternate form (`{:#}`) is used.
#[rustfmt::skip]
impl<'a, T> fmt::Display for Uri<'a, bitcoin::address::NetworkChecked, T> where for<'b> &'b T: SerializeParams {
impl<T> fmt::Display for Uri<'_, bitcoin::address::NetworkChecked, T> where for<'b> &'b T: SerializeParams {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if f.alternate() {
write!(f, "bitcoin:{:#}", self.address)?;
Expand Down

0 comments on commit 8745ec3

Please sign in to comment.