2024-04-07 automated rustfmt nightly

This commit is contained in:
Fmt Bot 2024-04-07 01:03:23 +00:00 committed by github-actions[bot]
parent bae2c75f69
commit 747ca578dd
5 changed files with 11 additions and 11 deletions

View File

@ -506,7 +506,10 @@ impl Address {
pub fn is_spend_standard(&self) -> bool { self.address_type().is_some() } pub fn is_spend_standard(&self) -> bool { self.address_type().is_some() }
/// Constructs an [`Address`] from an output script (`scriptPubkey`). /// Constructs an [`Address`] from an output script (`scriptPubkey`).
pub fn from_script(script: &Script, params: impl AsRef<Params>) -> Result<Address, FromScriptError> { pub fn from_script(
script: &Script,
params: impl AsRef<Params>,
) -> Result<Address, FromScriptError> {
let network = params.as_ref().network; let network = params.as_ref().network;
if script.is_p2pkh() { if script.is_p2pkh() {
let bytes = script.as_bytes()[3..23].try_into().expect("statically 20B long"); let bytes = script.as_bytes()[3..23].try_into().expect("statically 20B long");

View File

@ -198,8 +198,8 @@ mod test {
use hex::test_hex_unwrap as hex; use hex::test_hex_unwrap as hex;
use super::*; use super::*;
use crate::consensus::params;
use crate::consensus::encode::serialize; use crate::consensus::encode::serialize;
use crate::consensus::params;
#[test] #[test]
fn bitcoin_genesis_first_transaction() { fn bitcoin_genesis_first_transaction() {

View File

@ -229,9 +229,7 @@ impl Magic {
pub fn to_bytes(self) -> [u8; 4] { self.0 } pub fn to_bytes(self) -> [u8; 4] { self.0 }
/// Returns the magic bytes for the network defined by `params`. /// Returns the magic bytes for the network defined by `params`.
pub fn from_params(params: impl AsRef<Params>) -> Self { pub fn from_params(params: impl AsRef<Params>) -> Self { params.as_ref().network.into() }
params.as_ref().network.into()
}
} }
impl FromStr for Magic { impl FromStr for Magic {

View File

@ -18,7 +18,9 @@ use units::parse;
use crate::blockdata::block::BlockHash; use crate::blockdata::block::BlockHash;
use crate::consensus::encode::{self, Decodable, Encodable}; use crate::consensus::encode::{self, Decodable, Encodable};
use crate::consensus::Params; use crate::consensus::Params;
use crate::error::{ContainsPrefixError, MissingPrefixError, ParseIntError, PrefixedHexError, UnprefixedHexError}; use crate::error::{
ContainsPrefixError, MissingPrefixError, ParseIntError, PrefixedHexError, UnprefixedHexError,
};
/// Implement traits and methods shared by `Target` and `Work`. /// Implement traits and methods shared by `Target` and `Work`.
macro_rules! do_impl { macro_rules! do_impl {

View File

@ -45,17 +45,14 @@ pub mod parse;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub mod weight; pub mod weight;
pub use self::amount::ParseAmountError;
#[doc(inline)] #[doc(inline)]
pub use self::amount::{Amount, SignedAmount}; pub use self::amount::{Amount, SignedAmount};
pub use self::amount::ParseAmountError;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub use self::parse::ParseIntError; pub use self::parse::ParseIntError;
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
#[doc(inline)] #[doc(inline)]
pub use self::{ pub use self::{fee_rate::FeeRate, weight::Weight};
fee_rate::FeeRate,
weight::Weight,
};
#[rustfmt::skip] #[rustfmt::skip]
#[allow(unused_imports)] #[allow(unused_imports)]