Merge rust-bitcoin/rust-bitcoin#2939: Automated nightly rustfmt (2024-06-30)

19b093080b 2024-06-30 automated rustfmt nightly (Fmt Bot)

Pull request description:

  Automated nightly `rustfmt` changes by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action

ACKs for top commit:
  apoelstra:
    ACK 19b093080b

Tree-SHA512: 50d905ab4823e5e746751c0aacd145fc5640c9cb250d99bcd44800c72a890562c0014a9eee21602198388dee7bd9354ff764bab5616aac82bf7660669f8c2ee1
This commit is contained in:
merge-script 2024-06-30 12:09:40 +00:00
commit 96dffb2152
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
5 changed files with 30 additions and 37 deletions

View File

@ -32,8 +32,8 @@ use core::fmt;
use core::marker::PhantomData; use core::marker::PhantomData;
use core::str::FromStr; use core::str::FromStr;
use bech32::primitives::hrp::Hrp;
use bech32::primitives::gf32::Fe32; use bech32::primitives::gf32::Fe32;
use bech32::primitives::hrp::Hrp;
use hashes::{sha256, HashEngine}; use hashes::{sha256, HashEngine};
use secp256k1::{Secp256k1, Verification, XOnlyPublicKey}; use secp256k1::{Secp256k1, Verification, XOnlyPublicKey};

View File

@ -5,9 +5,8 @@
//! Provides the [`Work`] and [`Target`] types that are used in proof-of-work calculations. The //! Provides the [`Work`] and [`Target`] types that are used in proof-of-work calculations. The
//! functions here are designed to be fast, by that we mean it is safe to use them to check headers. //! functions here are designed to be fast, by that we mean it is safe to use them to check headers.
use core::cmp;
use core::fmt;
use core::ops::{Add, Div, Mul, Not, Rem, Shl, Shr, Sub}; use core::ops::{Add, Div, Mul, Not, Rem, Shl, Shr, Sub};
use core::{cmp, fmt};
use io::{BufRead, Write}; use io::{BufRead, Write};
#[cfg(all(test, mutate))] #[cfg(all(test, mutate))]

View File

@ -133,41 +133,33 @@ pub use self::{
hmac::{Hmac, HmacEngine}, hmac::{Hmac, HmacEngine},
}; };
/// SHA-1: Alias for the [`sha1::Hash`] hash type.
#[doc(inline)]
pub use sha1::Hash as Sha1;
/// SHA-256: Alias for the [`sha256::Hash`] hash type.
#[doc(inline)]
pub use sha256::Hash as Sha256;
/// SHA-384: Alias for the [`sha384::Hash`] hash type.
#[doc(inline)]
pub use sha384::Hash as Sha384;
/// SHA-512: Alias for the [`sha512::Hash`] hash type.
#[doc(inline)]
pub use sha512::Hash as Sha512;
/// SHA-512-256: Alias for the [`sha512_256::Hash`] hash type.
#[doc(inline)]
pub use sha512_256::Hash as Sha512_256;
/// RIPEMD-160: Alias for the [`ripemd160::Hash`] hash type.
#[doc(inline)]
pub use ripemd160::Hash as Ripemd160;
/// SipHash-2-4: Alias for the [`siphash24::Hash`] hash type.
#[doc(inline)]
pub use siphash24::Hash as Siphash24;
/// HASH-160: Alias for the [`hash160::Hash`] hash type. /// HASH-160: Alias for the [`hash160::Hash`] hash type.
#[doc(inline)] #[doc(inline)]
pub use hash160::Hash as Hash160; pub use hash160::Hash as Hash160;
/// RIPEMD-160: Alias for the [`ripemd160::Hash`] hash type.
#[doc(inline)]
pub use ripemd160::Hash as Ripemd160;
/// SHA-1: Alias for the [`sha1::Hash`] hash type.
#[doc(inline)]
pub use sha1::Hash as Sha1;
/// SHA-256: Alias for the [`sha256::Hash`] hash type.
#[doc(inline)]
pub use sha256::Hash as Sha256;
/// Double SHA-256: Alias for the [`sha256d::Hash`] hash type. /// Double SHA-256: Alias for the [`sha256d::Hash`] hash type.
#[doc(inline)] #[doc(inline)]
pub use sha256d::Hash as Sha256d; pub use sha256d::Hash as Sha256d;
/// SHA-384: Alias for the [`sha384::Hash`] hash type.
#[doc(inline)]
pub use sha384::Hash as Sha384;
/// SHA-512: Alias for the [`sha512::Hash`] hash type.
#[doc(inline)]
pub use sha512::Hash as Sha512;
/// SHA-512-256: Alias for the [`sha512_256::Hash`] hash type.
#[doc(inline)]
pub use sha512_256::Hash as Sha512_256;
/// SipHash-2-4: Alias for the [`siphash24::Hash`] hash type.
#[doc(inline)]
pub use siphash24::Hash as Siphash24;
/// Tagged SHA-256: Type alias for the [`sha256t::Hash`] hash type. /// Tagged SHA-256: Type alias for the [`sha256t::Hash`] hash type.
pub type Sha256t<T> = sha256t::Hash<T>; pub type Sha256t<T> = sha256t::Hash<T>;

View File

@ -40,7 +40,9 @@ impl Error {
/// Returns a reference to this error. /// Returns a reference to this error.
#[cfg(all(feature = "alloc", not(feature = "std")))] #[cfg(all(feature = "alloc", not(feature = "std")))]
pub fn get_ref(&self) -> Option<&(dyn fmt::Debug + Send + Sync + 'static)> { self.error.as_deref() } pub fn get_ref(&self) -> Option<&(dyn fmt::Debug + Send + Sync + 'static)> {
self.error.as_deref()
}
} }
impl From<ErrorKind> for Error { impl From<ErrorKind> for Error {
@ -196,7 +198,9 @@ mod sealed {
} }
impl IntoBoxDynDebug for &str { impl IntoBoxDynDebug for &str {
fn into(self) -> Box<dyn fmt::Debug + Send + Sync + 'static> { Box::new(String::from(self)) } fn into(self) -> Box<dyn fmt::Debug + Send + Sync + 'static> {
Box::new(String::from(self))
}
} }
impl IntoBoxDynDebug for String { impl IntoBoxDynDebug for String {

View File

@ -98,8 +98,7 @@ impl Denomination {
/// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli. /// These form are ambigous and could have many meanings. For example, M could denote Mega or Milli.
/// If any of these forms are used, an error type PossiblyConfusingDenomination is returned. /// If any of these forms are used, an error type PossiblyConfusingDenomination is returned.
const CONFUSING_FORMS: [&str; 6] = const CONFUSING_FORMS: [&str; 6] = ["MBTC", "Mbtc", "CBTC", "Cbtc", "UBTC", "Ubtc"];
["MBTC", "Mbtc", "CBTC", "Cbtc", "UBTC", "Ubtc"];
impl fmt::Display for Denomination { impl fmt::Display for Denomination {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) } fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str(self.as_str()) }
@ -2611,7 +2610,6 @@ mod tests {
sa_str(&sa_sat(i64::MIN).to_string_in(D::Satoshi), D::MicroBitcoin), sa_str(&sa_sat(i64::MIN).to_string_in(D::Satoshi), D::MicroBitcoin),
Err(OutOfRangeError::too_small().into()) Err(OutOfRangeError::too_small().into())
); );
} }
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]