Merge rust-bitcoin/rust-bitcoin#2668: Automated nightly rustfmt (2024-04-07)
747ca578dd
2024-04-07 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: ACK747ca578dd
tcharding: ACK747ca578dd
Tree-SHA512: c4387388f2cfcb9b9aacf7023d024379cbf073166f04fcba4b4c0d66972ee109f4c9f66e0d8ed1d57c419266680a9e6953a5e38ecb0aa937e6c368d59aaba976
This commit is contained in:
commit
163bf64fcc
|
@ -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");
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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)]
|
||||||
|
|
Loading…
Reference in New Issue