diff --git a/base58/src/error.rs b/base58/src/error.rs index f926acf52..6257056ec 100644 --- a/base58/src/error.rs +++ b/base58/src/error.rs @@ -145,7 +145,7 @@ internals::impl_from_infallible!(InvalidCharacterError); internals::impl_from_infallible!(InvalidCharacterErrorInner); impl InvalidCharacterError { - pub(super) fn new(invalid: u8) -> Self { Self(InvalidCharacterErrorInner{ invalid }) } + pub(super) fn new(invalid: u8) -> Self { Self(InvalidCharacterErrorInner { invalid }) } /// Returns the invalid base58 character. pub fn invalid_character(&self) -> u8 { self.0.invalid } diff --git a/bitcoin/src/consensus/serde.rs b/bitcoin/src/consensus/serde.rs index 32f9d417f..66d06033d 100644 --- a/bitcoin/src/consensus/serde.rs +++ b/bitcoin/src/consensus/serde.rs @@ -74,7 +74,9 @@ pub mod hex { pub struct Encoder(BufEncoder<{ HEX_BUF_SIZE }>, PhantomData); impl From> for Encoder { - fn from(_: super::Hex) -> Self { Encoder(BufEncoder::new(C::INTERNAL_CASE), Default::default()) } + fn from(_: super::Hex) -> Self { + Encoder(BufEncoder::new(C::INTERNAL_CASE), Default::default()) + } } impl super::EncodeBytes for Encoder { diff --git a/bitcoin/src/crypto/key.rs b/bitcoin/src/crypto/key.rs index 86103e97d..4ebf4f82e 100644 --- a/bitcoin/src/crypto/key.rs +++ b/bitcoin/src/crypto/key.rs @@ -446,7 +446,6 @@ impl PrivateKey { } } - /// Serializes the private key to bytes. #[deprecated(since = "TBD", note = "use to_vec instead")] pub fn to_bytes(self) -> Vec { self.to_vec() } diff --git a/chacha20_poly1305/src/chacha20.rs b/chacha20_poly1305/src/chacha20.rs index 20b4ac605..fa7798ce8 100644 --- a/chacha20_poly1305/src/chacha20.rs +++ b/chacha20_poly1305/src/chacha20.rs @@ -327,6 +327,7 @@ fn keystream_at_slice(key: Key, nonce: Nonce, count: u32, seek: usize) -> [u8; 6 #[cfg(feature = "alloc")] mod tests { use alloc::vec::Vec; + use hex::prelude::*; use super::*; diff --git a/chacha20_poly1305/src/lib.rs b/chacha20_poly1305/src/lib.rs index 7f60209f7..30e98836f 100644 --- a/chacha20_poly1305/src/lib.rs +++ b/chacha20_poly1305/src/lib.rs @@ -150,6 +150,7 @@ fn encode_lengths(aad_len: u64, content_len: u64) -> [u8; 16] { #[cfg(feature = "alloc")] mod tests { use alloc::vec::Vec; + use hex::prelude::*; use super::*; diff --git a/chacha20_poly1305/src/poly1305.rs b/chacha20_poly1305/src/poly1305.rs index 50d0e0a22..39e4e7a83 100644 --- a/chacha20_poly1305/src/poly1305.rs +++ b/chacha20_poly1305/src/poly1305.rs @@ -224,6 +224,7 @@ fn _print_acc(num: &[u32; 5]) { #[cfg(feature = "alloc")] mod tests { use alloc::vec::Vec; + use hex::prelude::*; use super::*; diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs index 6991b3310..85cdfe819 100644 --- a/primitives/src/lib.rs +++ b/primitives/src/lib.rs @@ -66,7 +66,7 @@ pub use self::{ #[cfg(feature = "alloc")] pub use self::{ locktime::{absolute, relative}, - transaction::{TxIn, TxOut, Transaction}, + transaction::{Transaction, TxIn, TxOut}, witness::Witness, }; diff --git a/primitives/src/locktime/relative.rs b/primitives/src/locktime/relative.rs index 79e083471..67adea787 100644 --- a/primitives/src/locktime/relative.rs +++ b/primitives/src/locktime/relative.rs @@ -12,9 +12,9 @@ use core::{cmp, convert, fmt}; #[cfg(all(test, mutate))] use mutagen::mutate; +use crate::Sequence; #[cfg(all(doc, feature = "alloc"))] use crate::{relative, TxIn}; -use crate::Sequence; #[rustfmt::skip] // Keep public re-exports separate. #[doc(inline)] diff --git a/units/src/locktime/absolute.rs b/units/src/locktime/absolute.rs index 8407eaece..f5a82c213 100644 --- a/units/src/locktime/absolute.rs +++ b/units/src/locktime/absolute.rs @@ -307,7 +307,9 @@ internals::impl_from_infallible!(ParseError); impl ParseError { fn invalid_int>(s: S) -> impl FnOnce(core::num::ParseIntError) -> Self { - move |source| Self::ParseInt(ParseIntError { input: s.into(), bits: 32, is_signed: true , source }) + move |source| { + Self::ParseInt(ParseIntError { input: s.into(), bits: 32, is_signed: true, source }) + } } fn display( @@ -322,13 +324,29 @@ impl ParseError { use ParseError::*; match self { - ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) if *source.kind() == IntErrorKind::PosOverflow => { + ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) + if *source.kind() == IntErrorKind::PosOverflow => + { // Outputs "failed to parse as absolute Height/Time ( is above limit )" - write!(f, "{} ({} is above limit {})", input.display_cannot_parse("absolute Height/Time"), subject, upper_bound) + write!( + f, + "{} ({} is above limit {})", + input.display_cannot_parse("absolute Height/Time"), + subject, + upper_bound + ) } - ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) if *source.kind() == IntErrorKind::NegOverflow => { + ParseInt(ParseIntError { input, bits: _, is_signed: _, source }) + if *source.kind() == IntErrorKind::NegOverflow => + { // Outputs "failed to parse as absolute Height/Time ( is below limit )" - write!(f, "{} ({} is below limit {})", input.display_cannot_parse("absolute Height/Time"), subject, lower_bound) + write!( + f, + "{} ({} is below limit {})", + input.display_cannot_parse("absolute Height/Time"), + subject, + lower_bound + ) } ParseInt(ParseIntError { input, bits: _, is_signed: _, source: _ }) => { write!(f, "{} ({})", input.display_cannot_parse("absolute Height/Time"), subject) @@ -350,8 +368,12 @@ impl ParseError { use ParseError::*; match self { - ParseInt(ParseIntError { source, .. }) if *source.kind() == IntErrorKind::PosOverflow => None, - ParseInt(ParseIntError { source, .. }) if *source.kind() == IntErrorKind::NegOverflow => None, + ParseInt(ParseIntError { source, .. }) + if *source.kind() == IntErrorKind::PosOverflow => + None, + ParseInt(ParseIntError { source, .. }) + if *source.kind() == IntErrorKind::NegOverflow => + None, ParseInt(ParseIntError { source, .. }) => Some(source), Conversion(_) => None, } diff --git a/units/src/parse.rs b/units/src/parse.rs index 9e670c5bb..7eb3f19c6 100644 --- a/units/src/parse.rs +++ b/units/src/parse.rs @@ -5,8 +5,8 @@ use core::fmt; use core::str::FromStr; -use internals::write_err; use internals::error::InputString; +use internals::write_err; /// Error with rich context returned when a string can't be parsed as an integer. ///