diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 4893ea4..6420200 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,6 +1,6 @@ name: build -on: push +on: pull_request jobs: codestyle: @@ -37,10 +37,10 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] - rust: [stable, 1.56.1] + rust: [stable, 1.63.0] exclude: - os: macOS-latest - rust: 1.56.1 + rust: 1.63.0 runs-on: ${{ matrix.os }} steps: @@ -50,5 +50,9 @@ jobs: rust-version: ${{ matrix.rust }} - name: Checkout uses: actions/checkout@v2 + - name: Fixes for MSRV + if: matrix.rust == '1.63.0' + run: | + cargo update - name: Test run: cargo test diff --git a/README.md b/README.md index 631dbdf..65bbca4 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ The crate is `no_std` but does require `alloc`. ## MSRV -1.56.1 +1.63.0 ## License diff --git a/src/de.rs b/src/de.rs index df5945a..c5f3c48 100644 --- a/src/de.rs +++ b/src/de.rs @@ -93,7 +93,7 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T } } -impl<'a, NetVal: NetworkValidation, T> Uri<'a, NetVal, T> { +impl Uri<'_, NetVal, T> { /// Makes the lifetime `'static` by converting all fields to owned. /// /// Note that this does **not** affect `extras`! @@ -234,6 +234,7 @@ impl std::error::Error for Error< pub struct UriError(UriErrorInner); #[derive(Debug, Clone)] +#[cfg_attr(not(feature = "std"), allow(dead_code))] enum UriErrorInner { TooShort, InvalidScheme, @@ -293,7 +294,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 DeserializeParams<'de>> core::str::FromStr for Uri<'_, bitcoin::address::NetworkUnchecked, T> { type Err = Error; fn from_str(s: &str) -> Result { @@ -310,7 +311,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 for Uri<'a, bitcoin::address::NetworkUnchecked, T> { +impl DeserializeParams<'de>> TryFrom for Uri<'_, bitcoin::address::NetworkUnchecked, T> { type Error = Error; fn try_from(s: String) -> Result { diff --git a/src/lib.rs b/src/lib.rs index b60eba5..25af98c 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -102,7 +102,7 @@ where pub extras: Extras, } -impl<'a, NetVal: NetworkValidation, T: Default> Uri<'a, NetVal, T> { +impl Uri<'_, NetVal, T> { /// Creates an URI with defaults. /// /// This sets all fields except `address` to default values. @@ -118,7 +118,7 @@ impl<'a, NetVal: NetworkValidation, T: Default> Uri<'a, NetVal, T> { } } -impl<'a, NetVal: NetworkValidation, T> Uri<'a, NetVal, T> { +impl Uri<'_, NetVal, T> { /// Creates an URI with defaults. /// /// This sets all fields except `address` and `extras` to default values. @@ -194,7 +194,7 @@ impl<'a> From<&'a str> for Param<'a> { } /// Cheap conversion -impl<'a> From for Param<'a> { +impl From for Param<'_> { fn from(value: String) -> Self { Param(ParamInner::UnencodedString(Cow::Owned(value))) } @@ -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> for Param<'a> { +impl From> for Param<'_> { fn from(value: Vec) -> Self { Param(ParamInner::UnencodedBytes(Cow::Owned(value))) } @@ -284,6 +284,7 @@ enum ParamInner<'a> { /// The lifetime of this may be shorter than that of [`Param<'a>`]. #[cfg(feature = "non-compliant-bytes")] #[cfg_attr(docsrs, doc(cfg(feature = "non-compliant-bytes")))] +#[cfg_attr(feature = "non-compliant-bytes", allow(dead_code))] pub struct ParamBytes<'a>(ParamIterInner<'a, core::iter::Cloned>>); /// Iterator over decoded bytes inside paramter. @@ -291,6 +292,7 @@ pub struct ParamBytes<'a>(ParamIterInner<'a, core::iter::Cloned`]. #[cfg(feature = "non-compliant-bytes")] #[cfg_attr(docsrs, doc(cfg(feature = "non-compliant-bytes")))] +#[cfg_attr(feature = "non-compliant-bytes", allow(dead_code))] pub struct ParamBytesOwned<'a>(ParamIterInner<'a, Either>, alloc::vec::IntoIter>>); #[cfg(feature = "non-compliant-bytes")] @@ -315,7 +317,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 { @@ -331,7 +333,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)>; diff --git a/src/ser.rs b/src/ser.rs index a77ca6a..9451097 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -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 fmt::Write for EqSignChecker<'_, W> { fn write_str(&mut self, s: &str) -> fmt::Result { if s.contains('=') { panic!("key '{}' contains equal sign", self.1); @@ -128,7 +128,7 @@ impl fmt::Display for DisplayEncoder { /// 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 @@ -175,7 +175,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 fmt::Display for Uri<'_, bitcoin::address::NetworkChecked, T> where for<'a> &'a T: SerializeParams { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if f.alternate() { write!(f, "bitcoin:{:#}", self.address)?;