Merge rust-bitcoin/rust-bitcoin#880: Use conventional spacing for default type parameters
1629348c24
Use conventional spacing for default type parameters (Tobin Harding) Pull request description: The exact code formatting we use is not as important as uniformity. Since we do not use tooling to control the formatting we have to be vigilant ourselves. Recently I (Tobin) changed the way default type parameters were formatted (arbitrarily but uniformly). Turns out I picked the wrong way, there is already a convention as shown in the rust documentation online (e.g. [1]). Use 'conventional' spacing for default type parameters. Make the changeacross the whole repository, found using git grep '\<.* = .*\>' [1] - https://doc.rust-lang.org/book/ch19-03-advanced-traits.html **Note** I also audited our whole stack to make sure I had not botched this anywhere else. Apologies for the code churn. ACKs for top commit: dr-orlovsky: utACK1629348c24
apoelstra: ACK1629348c24
Tree-SHA512: 61c8a22acc557d8b99f7b591cf8f91b94778a954ac1c9d6cf04a2bbd10953c241e8298e71928aad3b065c98117b816b913226d973fdaa9c3a1aea8daf8bcbe72
This commit is contained in:
commit
1cde71ea44
|
@ -946,7 +946,7 @@ pub trait CheckedSum<R>: private::SumSeal<R> {
|
||||||
fn checked_sum(self) -> Option<R>;
|
fn checked_sum(self) -> Option<R>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> CheckedSum<Amount> for T where T: Iterator<Item = Amount> {
|
impl<T> CheckedSum<Amount> for T where T: Iterator<Item=Amount> {
|
||||||
fn checked_sum(mut self) -> Option<Amount> {
|
fn checked_sum(mut self) -> Option<Amount> {
|
||||||
let first = Some(self.next().unwrap_or_default());
|
let first = Some(self.next().unwrap_or_default());
|
||||||
|
|
||||||
|
@ -957,7 +957,7 @@ impl<T> CheckedSum<Amount> for T where T: Iterator<Item = Amount> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> CheckedSum<SignedAmount> for T where T: Iterator<Item = SignedAmount> {
|
impl<T> CheckedSum<SignedAmount> for T where T: Iterator<Item=SignedAmount> {
|
||||||
fn checked_sum(mut self) -> Option<SignedAmount> {
|
fn checked_sum(mut self) -> Option<SignedAmount> {
|
||||||
let first = Some(self.next().unwrap_or_default());
|
let first = Some(self.next().unwrap_or_default());
|
||||||
|
|
||||||
|
@ -971,8 +971,8 @@ mod private {
|
||||||
/// Used to seal the `CheckedSum` trait
|
/// Used to seal the `CheckedSum` trait
|
||||||
pub trait SumSeal<A> {}
|
pub trait SumSeal<A> {}
|
||||||
|
|
||||||
impl<T> SumSeal<Amount> for T where T: Iterator<Item = Amount> {}
|
impl<T> SumSeal<Amount> for T where T: Iterator<Item=Amount> {}
|
||||||
impl<T> SumSeal<SignedAmount> for T where T: Iterator<Item = SignedAmount> {}
|
impl<T> SumSeal<SignedAmount> for T where T: Iterator<Item=SignedAmount> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
|
|
|
@ -178,7 +178,7 @@ pub fn from_check(data: &str) -> Result<Vec<u8>, Error> {
|
||||||
|
|
||||||
fn format_iter<I, W>(writer: &mut W, data: I) -> Result<(), fmt::Error>
|
fn format_iter<I, W>(writer: &mut W, data: I) -> Result<(), fmt::Error>
|
||||||
where
|
where
|
||||||
I: Iterator<Item = u8> + Clone,
|
I: Iterator<Item=u8> + Clone,
|
||||||
W: fmt::Write
|
W: fmt::Write
|
||||||
{
|
{
|
||||||
let mut ret = SmallVec::new();
|
let mut ret = SmallVec::new();
|
||||||
|
@ -219,7 +219,7 @@ where
|
||||||
|
|
||||||
fn encode_iter<I>(data: I) -> String
|
fn encode_iter<I>(data: I) -> String
|
||||||
where
|
where
|
||||||
I: Iterator<Item = u8> + Clone,
|
I: Iterator<Item=u8> + Clone,
|
||||||
{
|
{
|
||||||
let mut ret = String::new();
|
let mut ret = String::new();
|
||||||
format_iter(&mut ret, data).expect("writing into string shouldn't fail");
|
format_iter(&mut ret, data).expect("writing into string shouldn't fail");
|
||||||
|
|
|
@ -284,7 +284,7 @@ impl<'a> From<&'a [ChildNumber]> for DerivationPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ::core::iter::FromIterator<ChildNumber> for DerivationPath {
|
impl ::core::iter::FromIterator<ChildNumber> for DerivationPath {
|
||||||
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item = ChildNumber> {
|
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=ChildNumber> {
|
||||||
DerivationPath(Vec::from_iter(iter))
|
DerivationPath(Vec::from_iter(iter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ pub fn bitcoin_merkle_root<T, I>(mut hashes: I) -> Option<T>
|
||||||
where
|
where
|
||||||
T: Hash + Encodable,
|
T: Hash + Encodable,
|
||||||
<T as Hash>::Engine: io::Write,
|
<T as Hash>::Engine: io::Write,
|
||||||
I: Iterator<Item = T>,
|
I: Iterator<Item=T>,
|
||||||
{
|
{
|
||||||
let first = hashes.next()?;
|
let first = hashes.next()?;
|
||||||
let second = match hashes.next() {
|
let second = match hashes.next() {
|
||||||
|
|
|
@ -56,7 +56,7 @@ pub type ProprietaryType = u8;
|
||||||
/// structure according to BIP 174.
|
/// structure according to BIP 174.
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
pub struct ProprietaryKey<Subtype = ProprietaryType> where Subtype: Copy + From<u8> + Into<u8> {
|
pub struct ProprietaryKey<Subtype=ProprietaryType> where Subtype: Copy + From<u8> + Into<u8> {
|
||||||
/// Proprietary type prefix used for grouping together keys under some
|
/// Proprietary type prefix used for grouping together keys under some
|
||||||
/// application and avoid namespace collision
|
/// application and avoid namespace collision
|
||||||
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::hex_bytes"))]
|
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::hex_bytes"))]
|
||||||
|
|
|
@ -36,7 +36,7 @@ use super::taproot::LeafVersion;
|
||||||
|
|
||||||
/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
|
/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SigHashCache<T: Deref<Target = Transaction>> {
|
pub struct SigHashCache<T: Deref<Target=Transaction>> {
|
||||||
/// Access to transaction required for various introspection, moreover type
|
/// Access to transaction required for various introspection, moreover type
|
||||||
/// `T: Deref<Target=Transaction>` allows to accept borrow and mutable borrow, the
|
/// `T: Deref<Target=Transaction>` allows to accept borrow and mutable borrow, the
|
||||||
/// latter in particular is necessary for [`SigHashCache::witness_mut`]
|
/// latter in particular is necessary for [`SigHashCache::witness_mut`]
|
||||||
|
@ -295,7 +295,7 @@ impl SchnorrSigHashType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: Deref<Target = Transaction>> SigHashCache<R> {
|
impl<R: Deref<Target=Transaction>> SigHashCache<R> {
|
||||||
/// Compute the sighash components from an unsigned transaction and auxiliary
|
/// Compute the sighash components from an unsigned transaction and auxiliary
|
||||||
/// in a lazy manner when required.
|
/// in a lazy manner when required.
|
||||||
/// For the generated sighashes to be valid, no fields in the transaction may change except for
|
/// For the generated sighashes to be valid, no fields in the transaction may change except for
|
||||||
|
@ -692,7 +692,7 @@ impl<R: Deref<Target = Transaction>> SigHashCache<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<R: DerefMut<Target = Transaction>> SigHashCache<R> {
|
impl<R: DerefMut<Target=Transaction>> SigHashCache<R> {
|
||||||
/// When the SigHashCache is initialized with a mutable reference to a transaction instead of a
|
/// When the SigHashCache is initialized with a mutable reference to a transaction instead of a
|
||||||
/// regular reference, this method is available to allow modification to the witnesses.
|
/// regular reference, this method is available to allow modification to the witnesses.
|
||||||
///
|
///
|
||||||
|
|
|
@ -215,7 +215,7 @@ impl TaprootSpendInfo {
|
||||||
script_weights: I,
|
script_weights: I,
|
||||||
) -> Result<Self, TaprootBuilderError>
|
) -> Result<Self, TaprootBuilderError>
|
||||||
where
|
where
|
||||||
I: IntoIterator<Item = (u32, Script)>,
|
I: IntoIterator<Item=(u32, Script)>,
|
||||||
C: secp256k1::Verification,
|
C: secp256k1::Verification,
|
||||||
{
|
{
|
||||||
let mut node_weights = BinaryHeap::<(Reverse<u64>, NodeInfo)>::new();
|
let mut node_weights = BinaryHeap::<(Reverse<u64>, NodeInfo)>::new();
|
||||||
|
|
Loading…
Reference in New Issue