2024-12-22 automated rustfmt nightly
This commit is contained in:
parent
1c405524e8
commit
19acae7163
|
@ -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).
|
||||
|
@ -298,9 +298,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