Skip to content

Commit 9eff241

Browse files
committed
modernize rustfmt::skip syntax and run cargo fmt
1 parent 1f3357d commit 9eff241

File tree

6 files changed

+28
-30
lines changed

6 files changed

+28
-30
lines changed

contrib/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fi
1717
if [ "$DO_FMT" = true ]
1818
then
1919
rustup component add rustfmt
20-
cargo fmt -- --check
20+
cargo fmt --check
2121
fi
2222

2323
# Pin dependencies required to build with Rust 1.48.0

examples/sign_multisig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ fn spending_transaction() -> bitcoin::Transaction {
9393
}
9494
}
9595

96+
#[rustfmt::skip]
9697
fn list_of_three_arbitrary_public_keys() -> Vec<bitcoin::PublicKey> {
97-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
9898
vec![
9999
bitcoin::PublicKey::from_slice(&[2; 33]).expect("key 1"),
100100
bitcoin::PublicKey::from_slice(&[

examples/verify_tx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ fn main() {
104104
}
105105

106106
/// Returns an arbitrary transaction.
107+
#[rustfmt::skip]
107108
fn hard_coded_transaction() -> bitcoin::Transaction {
108109
// tx `f27eba163c38ad3f34971198687a3f1882b7ec818599ffe469a8440d82261c98`
109-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
110110
let tx_bytes = vec![
111111
0x01, 0x00, 0x00, 0x00, 0x02, 0xc5, 0x11, 0x1d, 0xb7, 0x93, 0x50, 0xc1,
112112
0x70, 0x28, 0x41, 0x39, 0xe8, 0xe3, 0x4e, 0xb0, 0xed, 0xba, 0x64, 0x7b,

src/miniscript/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ mod private {
6969
phantom: PhantomData<Ctx>,
7070
}
7171
impl<Pk: MiniscriptKey, Ctx: ScriptContext> Miniscript<Pk, Ctx> {
72-
7372
/// Add type information(Type and Extdata) to Miniscript based on
7473
/// `AstElem` fragment. Dependent on display and clone because of Error
7574
/// Display code of type_check.
@@ -623,12 +622,11 @@ mod tests {
623622
use sync::Arc;
624623

625624
use super::{Miniscript, ScriptContext, Segwitv0, Tap};
626-
use crate::miniscript::types;
627-
use crate::miniscript::Terminal;
625+
use crate::miniscript::{types, Terminal};
628626
use crate::policy::Liftable;
629-
use crate::{prelude::*, Error};
627+
use crate::prelude::*;
630628
use crate::test_utils::{StrKeyTranslator, StrXOnlyKeyTranslator};
631-
use crate::{hex_script, ExtParams, Satisfier, ToPublicKey, TranslatePk};
629+
use crate::{hex_script, Error, ExtParams, Satisfier, ToPublicKey, TranslatePk};
632630

633631
type Segwitv0Script = Miniscript<bitcoin::PublicKey, Segwitv0>;
634632
type Tapscript = Miniscript<bitcoin::secp256k1::XOnlyPublicKey, Tap>;

src/miniscript/ms_tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ mod tests {
6868
}
6969

7070
#[test]
71-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
71+
#[rustfmt::skip]
7272
fn invalid_tests_from_alloy() {
7373
invalid_ms("or_b(or_i(0,sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(1))");
7474
invalid_ms("or_b(s:pk_h(A),after(500000001))");
@@ -5646,7 +5646,7 @@ mod tests {
56465646
invalid_ms("c:or_b(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),pk_k(A))");
56475647
}
56485648
#[test]
5649-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
5649+
#[rustfmt::skip]
56505650
fn mall_8f1e8_tests_from_alloy() {
56515651
ms_test("or_d(or_d(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(500000001))", "Bf");
56525652
ms_test("andor(sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc),or_d(multi(2,A,B,C),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),after(1))", "B");
@@ -9143,7 +9143,7 @@ mod tests {
91439143

91449144
}
91459145
#[test]
9146-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
9146+
#[rustfmt::skip]
91479147
fn main_tests_from_alloy() {
91489148
ms_test("or_d(or_d(multi(2,A,B,C),or_d(multi(2,D,E,F),multi(2,G,I,J))),multi(2,K,L,M))", "Bdusem");
91499149
ms_test("andor(multi(2,A,B,C),or_d(multi(2,D,E,F),sha256(926a54995ca48600920a19bf7bc502ca5f2f7d07e6f804c4f00ebf0325084dbc)),c:pk_h(G))", "Bdusem");
@@ -15044,7 +15044,7 @@ mod tests {
1504415044
}
1504515045

1504615046
#[test]
15047-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
15047+
#[rustfmt::skip]
1504815048
fn malleable_tests_from_alloy() {
1504915049
ms_test("and_v(v:after(500000001),or_d(j:multi(2,A,B,C),multi(2,D,E,F)))", "usB");
1505015050
ms_test("or_b(j:multi(2,A,B,C),a:andor(multi(2,D,E,F),multi(2,G,I,J),multi(2,K,L,M)))", "dBesu");
@@ -22076,8 +22076,8 @@ mod tests {
2207622076
// This does not actually test timelock mixing. See: https://github.com/rust-bitcoin/rust-miniscript/issues/514
2207722077
// for details
2207822078
#[test]
22079+
#[rustfmt::skip]
2207922080
fn conflict_tests_from_alloy() {
22080-
#[cfg_attr(feature="cargo-fmt", rustfmt_skip)]
2208122081
{
2208222082
ms_test("andor(multi(2,A,B,C),andor(multi(2,D,E,F),after(500000001),n:after(1)),0)","Bedsm");
2208322083
ms_test("and_v(v:after(500000001),or_d(multi(2,A,B,C),and_b(multi(2,D,E,F),a:after(1))))","Busm");

src/miniscript/types/extra_props.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl Property for ExtData {
160160
timelock_info: TimelockInfo::default(),
161161
exec_stack_elem_count_sat: Some(1),
162162
exec_stack_elem_count_dissat: None,
163-
tree_height : 0,
163+
tree_height: 0,
164164
}
165165
}
166166

@@ -176,7 +176,7 @@ impl Property for ExtData {
176176
timelock_info: TimelockInfo::default(),
177177
exec_stack_elem_count_sat: None,
178178
exec_stack_elem_count_dissat: Some(1),
179-
tree_height : 0,
179+
tree_height: 0,
180180
}
181181
}
182182

@@ -398,7 +398,7 @@ impl Property for ExtData {
398398
timelock_info: self.timelock_info,
399399
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
400400
exec_stack_elem_count_dissat: self.exec_stack_elem_count_dissat,
401-
tree_height : self.tree_height + 1,
401+
tree_height: self.tree_height + 1,
402402
})
403403
}
404404

@@ -414,7 +414,7 @@ impl Property for ExtData {
414414
timelock_info: self.timelock_info,
415415
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
416416
exec_stack_elem_count_dissat: self.exec_stack_elem_count_dissat,
417-
tree_height : self.tree_height + 1,
417+
tree_height: self.tree_height + 1,
418418
})
419419
}
420420

@@ -430,7 +430,7 @@ impl Property for ExtData {
430430
timelock_info: self.timelock_info,
431431
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
432432
exec_stack_elem_count_dissat: self.exec_stack_elem_count_dissat,
433-
tree_height : self.tree_height + 1,
433+
tree_height: self.tree_height + 1,
434434
})
435435
}
436436

@@ -449,7 +449,7 @@ impl Property for ExtData {
449449
// Even all V types push something onto the stack and then remove them
450450
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
451451
exec_stack_elem_count_dissat: Some(1),
452-
tree_height : self.tree_height + 1,
452+
tree_height: self.tree_height + 1,
453453
})
454454
}
455455

@@ -466,7 +466,7 @@ impl Property for ExtData {
466466
timelock_info: self.timelock_info,
467467
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
468468
exec_stack_elem_count_dissat: None,
469-
tree_height : self.tree_height + 1,
469+
tree_height: self.tree_height + 1,
470470
})
471471
}
472472

@@ -482,7 +482,7 @@ impl Property for ExtData {
482482
timelock_info: self.timelock_info,
483483
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
484484
exec_stack_elem_count_dissat: Some(1),
485-
tree_height : self.tree_height + 1,
485+
tree_height: self.tree_height + 1,
486486
})
487487
}
488488

@@ -499,7 +499,7 @@ impl Property for ExtData {
499499
// Technically max(1, self.exec_stack_elem_count_sat), same rationale as cast_dupif
500500
exec_stack_elem_count_sat: self.exec_stack_elem_count_sat,
501501
exec_stack_elem_count_dissat: self.exec_stack_elem_count_dissat,
502-
tree_height : self.tree_height + 1,
502+
tree_height: self.tree_height + 1,
503503
})
504504
}
505505

@@ -540,7 +540,7 @@ impl Property for ExtData {
540540
l.exec_stack_elem_count_dissat,
541541
r.exec_stack_elem_count_dissat.map(|x| x + 1),
542542
),
543-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
543+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
544544
})
545545
}
546546

@@ -564,7 +564,7 @@ impl Property for ExtData {
564564
r.exec_stack_elem_count_sat,
565565
),
566566
exec_stack_elem_count_dissat: None,
567-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
567+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
568568
})
569569
}
570570

@@ -604,7 +604,7 @@ impl Property for ExtData {
604604
l.exec_stack_elem_count_dissat,
605605
r.exec_stack_elem_count_dissat.map(|x| x + 1),
606606
),
607-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
607+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
608608
})
609609
}
610610

@@ -642,7 +642,7 @@ impl Property for ExtData {
642642
l.exec_stack_elem_count_dissat,
643643
r.exec_stack_elem_count_dissat.map(|x| x + 1),
644644
),
645-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
645+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
646646
};
647647
Ok(res)
648648
}
@@ -674,7 +674,7 @@ impl Property for ExtData {
674674
opt_max(r.exec_stack_elem_count_sat, l.exec_stack_elem_count_dissat),
675675
),
676676
exec_stack_elem_count_dissat: None,
677-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
677+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
678678
})
679679
}
680680

@@ -721,7 +721,7 @@ impl Property for ExtData {
721721
l.exec_stack_elem_count_dissat,
722722
r.exec_stack_elem_count_dissat,
723723
),
724-
tree_height : cmp::max(l.tree_height, r.tree_height) + 1,
724+
tree_height: cmp::max(l.tree_height, r.tree_height) + 1,
725725
})
726726
}
727727

@@ -764,7 +764,7 @@ impl Property for ExtData {
764764
a.exec_stack_elem_count_dissat,
765765
c.exec_stack_elem_count_dissat,
766766
),
767-
tree_height : cmp::max(a.tree_height, cmp::max(b.tree_height, c.tree_height)) + 1,
767+
tree_height: cmp::max(a.tree_height, cmp::max(b.tree_height, c.tree_height)) + 1,
768768
})
769769
}
770770

@@ -885,7 +885,7 @@ impl Property for ExtData {
885885
timelock_info: TimelockInfo::combine_threshold(k, timelocks),
886886
exec_stack_elem_count_sat,
887887
exec_stack_elem_count_dissat,
888-
tree_height : max_child_height + 1,
888+
tree_height: max_child_height + 1,
889889
})
890890
}
891891

0 commit comments

Comments
 (0)