2024-12-22 automated rustfmt nightly

This commit is contained in:
Fmt Bot 2024-12-22 01:21:54 +00:00 committed by github-actions[bot]
parent 1c405524e8
commit 19acae7163
5 changed files with 14 additions and 18 deletions

View File

@ -907,13 +907,11 @@ fn checked_sum_amounts() {
let sum = amounts.into_iter().checked_sum(); let sum = amounts.into_iter().checked_sum();
assert_eq!(None, sum); assert_eq!(None, sum);
let amounts = let amounts = [SignedAmount::MIN, SignedAmount::from_sat(-1), SignedAmount::from_sat(21)];
[SignedAmount::MIN, SignedAmount::from_sat(-1), SignedAmount::from_sat(21)];
let sum = amounts.into_iter().checked_sum(); let sum = amounts.into_iter().checked_sum();
assert_eq!(None, sum); assert_eq!(None, sum);
let amounts = let amounts = [SignedAmount::MAX, SignedAmount::from_sat(1), SignedAmount::from_sat(21)];
[SignedAmount::MAX, SignedAmount::from_sat(1), SignedAmount::from_sat(21)];
let sum = amounts.into_iter().checked_sum(); let sum = amounts.into_iter().checked_sum();
assert_eq!(None, sum); assert_eq!(None, sum);

View File

@ -30,7 +30,7 @@ macro_rules! impl_add_for_references {
fn add(self, rhs: &'a $ty) -> Self::Output { *self + *rhs } fn add(self, rhs: &'a $ty) -> Self::Output { *self + *rhs }
} }
} };
} }
pub(crate) use impl_add_for_references; pub(crate) use impl_add_for_references;
@ -44,7 +44,7 @@ macro_rules! impl_add_assign {
impl core::ops::AddAssign<&$ty> for $ty { impl core::ops::AddAssign<&$ty> for $ty {
fn add_assign(&mut self, rhs: &$ty) { *self = *self + *rhs } fn add_assign(&mut self, rhs: &$ty) { *self = *self + *rhs }
} }
} };
} }
pub(crate) use impl_add_assign; pub(crate) use impl_add_assign;
@ -74,7 +74,7 @@ macro_rules! impl_sub_for_references {
fn sub(self, rhs: &'a $ty) -> Self::Output { *self - *rhs } fn sub(self, rhs: &'a $ty) -> Self::Output { *self - *rhs }
} }
} };
} }
pub(crate) use impl_sub_for_references; pub(crate) use impl_sub_for_references;
@ -88,6 +88,6 @@ macro_rules! impl_sub_assign {
impl core::ops::SubAssign<&$ty> for $ty { impl core::ops::SubAssign<&$ty> for $ty {
fn sub_assign(&mut self, rhs: &$ty) { *self = *self - *rhs } fn sub_assign(&mut self, rhs: &$ty) { *self = *self - *rhs }
} }
} };
} }
pub(crate) use impl_sub_assign; pub(crate) use impl_sub_assign;

View File

@ -20,13 +20,13 @@
#![allow(unused_imports)] #![allow(unused_imports)]
// These imports test "typical" usage by user code. // These imports test "typical" usage by user code.
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
use bitcoin_units::locktime::{absolute, relative}; // Typical usage is `absolute::Height`. use bitcoin_units::locktime::{absolute, relative}; // Typical usage is `absolute::Height`.
use bitcoin_units::{ use bitcoin_units::{
amount, block, fee_rate, locktime, parse, weight, Amount, BlockHeight, BlockInterval, FeeRate, amount, block, fee_rate, locktime, parse, weight, Amount, BlockHeight, BlockInterval, FeeRate,
SignedAmount, Weight, SignedAmount, Weight,
}; };
#[cfg(feature = "arbitrary")]
use arbitrary::{Arbitrary, Unstructured};
/// A struct that includes all public non-error enums. /// A struct that includes all public non-error enums.
#[derive(Debug)] // All public types implement Debug (C-DEBUG). #[derive(Debug)] // All public types implement Debug (C-DEBUG).
@ -298,9 +298,7 @@ impl<'a> Arbitrary<'a> for Structs {
#[cfg(feature = "arbitrary")] #[cfg(feature = "arbitrary")]
impl<'a> Arbitrary<'a> for Enums { impl<'a> Arbitrary<'a> for Enums {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> { fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let a = Enums { let a = Enums { a: amount::Denomination::arbitrary(u)? };
a: amount::Denomination::arbitrary(u)?,
};
Ok(a) Ok(a)
} }
} }