Skip to content

Commit 1cde71e

Browse files
committed
Merge rust-bitcoin/rust-bitcoin#880: Use conventional spacing for default type parameters
1629348 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: utACK 1629348 apoelstra: ACK 1629348 Tree-SHA512: 61c8a22acc557d8b99f7b591cf8f91b94778a954ac1c9d6cf04a2bbd10953c241e8298e71928aad3b065c98117b816b913226d973fdaa9c3a1aea8daf8bcbe72
2 parents 443a385 + 1629348 commit 1cde71e

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

src/util/amount.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ pub trait CheckedSum<R>: private::SumSeal<R> {
946946
fn checked_sum(self) -> Option<R>;
947947
}
948948

949-
impl<T> CheckedSum<Amount> for T where T: Iterator<Item = Amount> {
949+
impl<T> CheckedSum<Amount> for T where T: Iterator<Item=Amount> {
950950
fn checked_sum(mut self) -> Option<Amount> {
951951
let first = Some(self.next().unwrap_or_default());
952952

@@ -957,7 +957,7 @@ impl<T> CheckedSum<Amount> for T where T: Iterator<Item = Amount> {
957957
}
958958
}
959959

960-
impl<T> CheckedSum<SignedAmount> for T where T: Iterator<Item = SignedAmount> {
960+
impl<T> CheckedSum<SignedAmount> for T where T: Iterator<Item=SignedAmount> {
961961
fn checked_sum(mut self) -> Option<SignedAmount> {
962962
let first = Some(self.next().unwrap_or_default());
963963

@@ -971,8 +971,8 @@ mod private {
971971
/// Used to seal the `CheckedSum` trait
972972
pub trait SumSeal<A> {}
973973

974-
impl<T> SumSeal<Amount> for T where T: Iterator<Item = Amount> {}
975-
impl<T> SumSeal<SignedAmount> for T where T: Iterator<Item = SignedAmount> {}
974+
impl<T> SumSeal<Amount> for T where T: Iterator<Item=Amount> {}
975+
impl<T> SumSeal<SignedAmount> for T where T: Iterator<Item=SignedAmount> {}
976976
}
977977

978978
#[cfg(feature = "serde")]

src/util/base58.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn from_check(data: &str) -> Result<Vec<u8>, Error> {
178178

179179
fn format_iter<I, W>(writer: &mut W, data: I) -> Result<(), fmt::Error>
180180
where
181-
I: Iterator<Item = u8> + Clone,
181+
I: Iterator<Item=u8> + Clone,
182182
W: fmt::Write
183183
{
184184
let mut ret = SmallVec::new();
@@ -219,7 +219,7 @@ where
219219

220220
fn encode_iter<I>(data: I) -> String
221221
where
222-
I: Iterator<Item = u8> + Clone,
222+
I: Iterator<Item=u8> + Clone,
223223
{
224224
let mut ret = String::new();
225225
format_iter(&mut ret, data).expect("writing into string shouldn't fail");

src/util/bip32.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ impl<'a> From<&'a [ChildNumber]> for DerivationPath {
284284
}
285285

286286
impl ::core::iter::FromIterator<ChildNumber> for DerivationPath {
287-
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item = ChildNumber> {
287+
fn from_iter<T>(iter: T) -> Self where T: IntoIterator<Item=ChildNumber> {
288288
DerivationPath(Vec::from_iter(iter))
289289
}
290290
}

src/util/hash.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn bitcoin_merkle_root<T, I>(mut hashes: I) -> Option<T>
5757
where
5858
T: Hash + Encodable,
5959
<T as Hash>::Engine: io::Write,
60-
I: Iterator<Item = T>,
60+
I: Iterator<Item=T>,
6161
{
6262
let first = hashes.next()?;
6363
let second = match hashes.next() {

src/util/psbt/raw.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub type ProprietaryType = u8;
5656
/// structure according to BIP 174.
5757
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
5858
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
59-
pub struct ProprietaryKey<Subtype = ProprietaryType> where Subtype: Copy + From<u8> + Into<u8> {
59+
pub struct ProprietaryKey<Subtype=ProprietaryType> where Subtype: Copy + From<u8> + Into<u8> {
6060
/// Proprietary type prefix used for grouping together keys under some
6161
/// application and avoid namespace collision
6262
#[cfg_attr(feature = "serde", serde(with = "::serde_utils::hex_bytes"))]

src/util/sighash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use super::taproot::LeafVersion;
3636

3737
/// Efficiently calculates signature hash message for legacy, segwit and taproot inputs.
3838
#[derive(Debug)]
39-
pub struct SigHashCache<T: Deref<Target = Transaction>> {
39+
pub struct SigHashCache<T: Deref<Target=Transaction>> {
4040
/// Access to transaction required for various introspection, moreover type
4141
/// `T: Deref<Target=Transaction>` allows to accept borrow and mutable borrow, the
4242
/// latter in particular is necessary for [`SigHashCache::witness_mut`]
@@ -295,7 +295,7 @@ impl SchnorrSigHashType {
295295
}
296296
}
297297

298-
impl<R: Deref<Target = Transaction>> SigHashCache<R> {
298+
impl<R: Deref<Target=Transaction>> SigHashCache<R> {
299299
/// Compute the sighash components from an unsigned transaction and auxiliary
300300
/// in a lazy manner when required.
301301
/// 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> {
692692
}
693693
}
694694

695-
impl<R: DerefMut<Target = Transaction>> SigHashCache<R> {
695+
impl<R: DerefMut<Target=Transaction>> SigHashCache<R> {
696696
/// When the SigHashCache is initialized with a mutable reference to a transaction instead of a
697697
/// regular reference, this method is available to allow modification to the witnesses.
698698
///

src/util/taproot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl TaprootSpendInfo {
215215
script_weights: I,
216216
) -> Result<Self, TaprootBuilderError>
217217
where
218-
I: IntoIterator<Item = (u32, Script)>,
218+
I: IntoIterator<Item=(u32, Script)>,
219219
C: secp256k1::Verification,
220220
{
221221
let mut node_weights = BinaryHeap::<(Reverse<u64>, NodeInfo)>::new();

0 commit comments

Comments
 (0)