2024-11-17 automated rustfmt nightly

This commit is contained in:
Fmt Bot 2024-11-17 01:23:55 +00:00 committed by github-actions[bot]
parent a3e9bad990
commit 500cd10802
5 changed files with 13 additions and 20 deletions

View File

@ -1083,24 +1083,16 @@ pub mod test_utils {
use crate::pow::{Target, Work, U256}; use crate::pow::{Target, Work, U256};
/// Converts a `u64` to a [`Work`] /// Converts a `u64` to a [`Work`]
pub fn u64_to_work(u: u64) -> Work { pub fn u64_to_work(u: u64) -> Work { Work(U256::from(u)) }
Work(U256::from(u))
}
/// Converts a `u128` to a [`Work`] /// Converts a `u128` to a [`Work`]
pub fn u128_to_work(u: u128) -> Work { pub fn u128_to_work(u: u128) -> Work { Work(U256::from(u)) }
Work(U256::from(u))
}
/// Converts a `u32` to a [`Target`] /// Converts a `u32` to a [`Target`]
pub fn u32_to_target(u: u32) -> Target { pub fn u32_to_target(u: u32) -> Target { Target(U256::from(u)) }
Target(U256::from(u))
}
/// Converts a `u64` to a [`Target`] /// Converts a `u64` to a [`Target`]
pub fn u64_to_target(u: u64) -> Target { pub fn u64_to_target(u: u64) -> Target { Target(U256::from(u)) }
Target(U256::from(u))
}
} }
#[cfg(test)] #[cfg(test)]

View File

@ -53,6 +53,7 @@ pub use units::{
fee_rate::{self, FeeRate}, fee_rate::{self, FeeRate},
weight::{self, Weight}, weight::{self, Weight},
}; };
#[doc(inline)] #[doc(inline)]
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
pub use self::{ pub use self::{

View File

@ -11,8 +11,8 @@ use core::{default, fmt, ops};
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use super::{ use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination, parse_signed_to_satoshi, split_amount_and_denomination, Amount, Denomination, Display,
Display, DisplayStyle, OutOfRangeError, ParseAmountError, ParseError, DisplayStyle, OutOfRangeError, ParseAmountError, ParseError,
}; };
/// A signed amount. /// A signed amount.

View File

@ -13,8 +13,8 @@ use ::serde::{Deserialize, Serialize};
use arbitrary::{Arbitrary, Unstructured}; use arbitrary::{Arbitrary, Unstructured};
use super::{ use super::{
parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display, parse_signed_to_satoshi, split_amount_and_denomination, Denomination, Display, DisplayStyle,
DisplayStyle, OutOfRangeError, ParseAmountError, ParseError, SignedAmount, OutOfRangeError, ParseAmountError, ParseError, SignedAmount,
}; };
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use crate::{FeeRate, Weight}; use crate::{FeeRate, Weight};

View File

@ -110,7 +110,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_add(rhs.0) { match self.0.checked_add(rhs.0) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -121,7 +121,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_sub(rhs.0) { match self.0.checked_sub(rhs.0) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -132,7 +132,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_mul(rhs) { match self.0.checked_mul(rhs) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
@ -143,7 +143,7 @@ impl Weight {
// No `map()` in const context. // No `map()` in const context.
match self.0.checked_div(rhs) { match self.0.checked_div(rhs) {
Some(wu) => Some(Weight::from_wu(wu)), Some(wu) => Some(Weight::from_wu(wu)),
None => None None => None,
} }
} }
} }