Merge rust-bitcoin/rust-bitcoin#3799: Automated nightly rustfmt (2024-12-22)
19acae7163
2024-12-22 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: tcharding: ACK19acae7163
apoelstra: ACK 19acae716334ce2b215e4baf1cf405d05b326a9a; successfully ran local tests Tree-SHA512: 93b1959faab558d8ebf825f70014cbef6ae21b28db7fff18bab4a3f1ae7c6ff331091a94548caf6d63dd5f0bb40e4d0833cb089388fbac4467e6ea80a9230dfc
This commit is contained in:
commit
dacf75594e
|
@ -193,7 +193,7 @@ mod tests {
|
|||
mod verification {
|
||||
use super::*;
|
||||
|
||||
#[kani::unwind(16)] // One greater than 15 (max number of elements).
|
||||
#[kani::unwind(16)] // One greater than 15 (max number of elements).
|
||||
#[kani::proof]
|
||||
fn no_out_of_bounds_less_than_cap() {
|
||||
const CAP: usize = 32;
|
||||
|
@ -212,7 +212,7 @@ mod verification {
|
|||
}
|
||||
}
|
||||
|
||||
#[kani::unwind(16)] // One grater than 15.
|
||||
#[kani::unwind(16)] // One grater than 15.
|
||||
#[kani::proof]
|
||||
fn no_out_of_bounds_upto_cap() {
|
||||
const CAP: usize = 15;
|
||||
|
|
|
@ -907,13 +907,11 @@ fn checked_sum_amounts() {
|
|||
let sum = amounts.into_iter().checked_sum();
|
||||
assert_eq!(None, sum);
|
||||
|
||||
let amounts =
|
||||
[SignedAmount::MIN, SignedAmount::from_sat(-1), SignedAmount::from_sat(21)];
|
||||
let amounts = [SignedAmount::MIN, SignedAmount::from_sat(-1), SignedAmount::from_sat(21)];
|
||||
let sum = amounts.into_iter().checked_sum();
|
||||
assert_eq!(None, sum);
|
||||
|
||||
let amounts =
|
||||
[SignedAmount::MAX, SignedAmount::from_sat(1), SignedAmount::from_sat(21)];
|
||||
let amounts = [SignedAmount::MAX, SignedAmount::from_sat(1), SignedAmount::from_sat(21)];
|
||||
let sum = amounts.into_iter().checked_sum();
|
||||
assert_eq!(None, sum);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ fn u_amount_homomorphic() {
|
|||
let n2 = kani::any::<u64>();
|
||||
// Assume we don't overflow in the actual tests.
|
||||
kani::assume(n1.checked_add(n2).is_some()); // Adding u64s doesn't overflow.
|
||||
let a1 = Amount::from_sat(n1); // TODO: If from_sat enforces invariant assume this `is_ok()`.
|
||||
let a1 = Amount::from_sat(n1); // TODO: If from_sat enforces invariant assume this `is_ok()`.
|
||||
let a2 = Amount::from_sat(n2);
|
||||
kani::assume(a1.checked_add(a2).is_some()); // Adding amounts doesn't overflow.
|
||||
|
||||
|
|
|
@ -30,21 +30,21 @@ macro_rules! impl_add_for_references {
|
|||
|
||||
fn add(self, rhs: &'a $ty) -> Self::Output { *self + *rhs }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(crate) use impl_add_for_references;
|
||||
|
||||
/// Implement `ops::AddAssign` for `$ty` and `&$ty`.
|
||||
macro_rules! impl_add_assign {
|
||||
($ty:ident) => {
|
||||
impl core::ops::AddAssign<$ty> for $ty {
|
||||
impl core::ops::AddAssign<$ty> for $ty {
|
||||
fn add_assign(&mut self, rhs: $ty) { *self = *self + rhs }
|
||||
}
|
||||
|
||||
impl core::ops::AddAssign<&$ty> for $ty {
|
||||
fn add_assign(&mut self, rhs: &$ty) { *self = *self + *rhs }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(crate) use impl_add_assign;
|
||||
|
||||
|
@ -74,20 +74,20 @@ macro_rules! impl_sub_for_references {
|
|||
|
||||
fn sub(self, rhs: &'a $ty) -> Self::Output { *self - *rhs }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(crate) use impl_sub_for_references;
|
||||
|
||||
/// Implement `ops::SubAssign` for `$ty` and `&$ty`.
|
||||
macro_rules! impl_sub_assign {
|
||||
($ty:ident) => {
|
||||
impl core::ops::SubAssign<$ty> for $ty {
|
||||
impl core::ops::SubAssign<$ty> for $ty {
|
||||
fn sub_assign(&mut self, rhs: $ty) { *self = *self - rhs }
|
||||
}
|
||||
|
||||
impl core::ops::SubAssign<&$ty> for $ty {
|
||||
fn sub_assign(&mut self, rhs: &$ty) { *self = *self - *rhs }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
pub(crate) use impl_sub_assign;
|
||||
|
|
|
@ -20,13 +20,13 @@
|
|||
#![allow(unused_imports)]
|
||||
|
||||
// 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::{
|
||||
amount, block, fee_rate, locktime, parse, weight, Amount, BlockHeight, BlockInterval, FeeRate,
|
||||
SignedAmount, Weight,
|
||||
};
|
||||
#[cfg(feature = "arbitrary")]
|
||||
use arbitrary::{Arbitrary, Unstructured};
|
||||
|
||||
/// A struct that includes all public non-error enums.
|
||||
#[derive(Debug)] // All public types implement Debug (C-DEBUG).
|
||||
|
@ -289,9 +289,7 @@ impl<'a> Arbitrary<'a> for Structs {
|
|||
#[cfg(feature = "arbitrary")]
|
||||
impl<'a> Arbitrary<'a> for Enums {
|
||||
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
|
||||
let a = Enums {
|
||||
a: amount::Denomination::arbitrary(u)?,
|
||||
};
|
||||
let a = Enums { a: amount::Denomination::arbitrary(u)? };
|
||||
Ok(a)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue