Skip to content

Commit 75d3fa8

Browse files
committed
Set array_width to 80
Set `rustfmt` config option `array_width` to 80 and run the formatter.
1 parent 1cab0b8 commit 75d3fa8

File tree

5 files changed

+36
-69
lines changed

5 files changed

+36
-69
lines changed

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn_call_width = 80
88
attr_fn_like_width = 70
99
struct_lit_width = 80
1010
struct_variant_width = 35
11-
array_width = 60
11+
array_width = 80
1212
chain_width = 60
1313
single_line_if_else_max_width = 50
1414
wrap_comments = false

src/interpreter/mod.rs

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,10 +1158,8 @@ mod tests {
11581158

11591159
//Check Pkh
11601160
let pk_bytes = pks[1].to_public_key().to_bytes();
1161-
let stack = Stack::from(vec![
1162-
stack::Element::Push(&der_sigs[1]),
1163-
stack::Element::Push(&pk_bytes),
1164-
]);
1161+
let stack =
1162+
Stack::from(vec![stack::Element::Push(&der_sigs[1]), stack::Element::Push(&pk_bytes)]);
11651163
let constraints = from_stack(Box::new(vfyfn), stack, &pkh);
11661164
let pkh_satisfied: Result<Vec<SatisfiedConstraint>, Error> = constraints.collect();
11671165
assert_eq!(
@@ -1265,10 +1263,8 @@ mod tests {
12651263
);
12661264

12671265
//Check AndB
1268-
let stack = Stack::from(vec![
1269-
stack::Element::Push(&preimage),
1270-
stack::Element::Push(&der_sigs[0]),
1271-
]);
1266+
let stack =
1267+
Stack::from(vec![stack::Element::Push(&preimage), stack::Element::Push(&der_sigs[0])]);
12721268
let elem = no_checks_ms(&format!("and_b(c:pk_k({}),sjtv:sha256({}))", pks[0], sha256_hash));
12731269
let constraints = from_stack(Box::new(vfyfn), stack, &elem);
12741270

@@ -1284,10 +1280,8 @@ mod tests {
12841280
);
12851281

12861282
//Check AndOr
1287-
let stack = Stack::from(vec![
1288-
stack::Element::Push(&preimage),
1289-
stack::Element::Push(&der_sigs[0]),
1290-
]);
1283+
let stack =
1284+
Stack::from(vec![stack::Element::Push(&preimage), stack::Element::Push(&der_sigs[0])]);
12911285
let elem = no_checks_ms(&format!(
12921286
"andor(c:pk_k({}),jtv:sha256({}),c:pk_h({}))",
12931287
pks[0], sha256_hash, pks[1],
@@ -1324,10 +1318,8 @@ mod tests {
13241318
);
13251319

13261320
//Check OrB
1327-
let stack = Stack::from(vec![
1328-
stack::Element::Push(&preimage),
1329-
stack::Element::Dissatisfied,
1330-
]);
1321+
let stack =
1322+
Stack::from(vec![stack::Element::Push(&preimage), stack::Element::Dissatisfied]);
13311323
let elem = no_checks_ms(&format!("or_b(c:pk_k({}),sjtv:sha256({}))", pks[0], sha256_hash));
13321324
let constraints = from_stack(Box::new(vfyfn), stack, &elem);
13331325

@@ -1354,10 +1346,8 @@ mod tests {
13541346
);
13551347

13561348
//Check OrC
1357-
let stack = Stack::from(vec![
1358-
stack::Element::Push(&der_sigs[0]),
1359-
stack::Element::Dissatisfied,
1360-
]);
1349+
let stack =
1350+
Stack::from(vec![stack::Element::Push(&der_sigs[0]), stack::Element::Dissatisfied]);
13611351
let elem =
13621352
no_checks_ms(&format!("t:or_c(jtv:sha256({}),vc:pk_k({}))", sha256_hash, pks[0]));
13631353
let constraints = from_stack(Box::new(vfyfn), stack, &elem);
@@ -1371,10 +1361,8 @@ mod tests {
13711361
);
13721362

13731363
//Check OrI
1374-
let stack = Stack::from(vec![
1375-
stack::Element::Push(&der_sigs[0]),
1376-
stack::Element::Dissatisfied,
1377-
]);
1364+
let stack =
1365+
Stack::from(vec![stack::Element::Push(&der_sigs[0]), stack::Element::Dissatisfied]);
13781366
let elem = no_checks_ms(&format!("or_i(jtv:sha256({}),c:pk_k({}))", sha256_hash, pks[0]));
13791367
let constraints = from_stack(Box::new(vfyfn), stack, &elem);
13801368

src/policy/concrete.rs

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,38 +1248,26 @@ mod compiler_tests {
12481248

12491249
let combinations = generate_combination(&policy_vec, 1.0, 2);
12501250

1251-
let comb_a: Vec<Arc<PolicyArc<String>>> = vec![
1252-
policy_str!("pk(B)"),
1253-
policy_str!("pk(C)"),
1254-
policy_str!("pk(D)"),
1255-
]
1256-
.into_iter()
1257-
.map(|pol| Arc::new(PolicyArc::from(pol)))
1258-
.collect();
1259-
let comb_b: Vec<Arc<PolicyArc<String>>> = vec![
1260-
policy_str!("pk(A)"),
1261-
policy_str!("pk(C)"),
1262-
policy_str!("pk(D)"),
1263-
]
1264-
.into_iter()
1265-
.map(|pol| Arc::new(PolicyArc::from(pol)))
1266-
.collect();
1267-
let comb_c: Vec<Arc<PolicyArc<String>>> = vec![
1268-
policy_str!("pk(A)"),
1269-
policy_str!("pk(B)"),
1270-
policy_str!("pk(D)"),
1271-
]
1272-
.into_iter()
1273-
.map(|pol| Arc::new(PolicyArc::from(pol)))
1274-
.collect();
1275-
let comb_d: Vec<Arc<PolicyArc<String>>> = vec![
1276-
policy_str!("pk(A)"),
1277-
policy_str!("pk(B)"),
1278-
policy_str!("pk(C)"),
1279-
]
1280-
.into_iter()
1281-
.map(|pol| Arc::new(PolicyArc::from(pol)))
1282-
.collect();
1251+
let comb_a: Vec<Arc<PolicyArc<String>>> =
1252+
vec![policy_str!("pk(B)"), policy_str!("pk(C)"), policy_str!("pk(D)")]
1253+
.into_iter()
1254+
.map(|pol| Arc::new(PolicyArc::from(pol)))
1255+
.collect();
1256+
let comb_b: Vec<Arc<PolicyArc<String>>> =
1257+
vec![policy_str!("pk(A)"), policy_str!("pk(C)"), policy_str!("pk(D)")]
1258+
.into_iter()
1259+
.map(|pol| Arc::new(PolicyArc::from(pol)))
1260+
.collect();
1261+
let comb_c: Vec<Arc<PolicyArc<String>>> =
1262+
vec![policy_str!("pk(A)"), policy_str!("pk(B)"), policy_str!("pk(D)")]
1263+
.into_iter()
1264+
.map(|pol| Arc::new(PolicyArc::from(pol)))
1265+
.collect();
1266+
let comb_d: Vec<Arc<PolicyArc<String>>> =
1267+
vec![policy_str!("pk(A)"), policy_str!("pk(B)"), policy_str!("pk(C)")]
1268+
.into_iter()
1269+
.map(|pol| Arc::new(PolicyArc::from(pol)))
1270+
.collect();
12831271
let expected_comb = vec![comb_a, comb_b, comb_c, comb_d]
12841272
.into_iter()
12851273
.map(|sub_pol| (0.25, Arc::new(PolicyArc::Threshold(2, sub_pol))))

src/policy/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,7 @@ impl<Pk: MiniscriptKey, Ctx: ScriptContext> Liftable<Pk> for Terminal<Pk, Ctx> {
139139
}
140140
Terminal::AndOr(ref a, ref b, ref c) => Semantic::Threshold(
141141
1,
142-
vec![
143-
Semantic::Threshold(2, vec![a.node.lift()?, b.node.lift()?]),
144-
c.node.lift()?,
145-
],
142+
vec![Semantic::Threshold(2, vec![a.node.lift()?, b.node.lift()?]), c.node.lift()?],
146143
),
147144
Terminal::OrB(ref left, ref right)
148145
| Terminal::OrD(ref left, ref right)
@@ -346,10 +343,7 @@ mod tests {
346343
vec![
347344
Semantic::Threshold(
348345
2,
349-
vec![
350-
Semantic::Key(key_a),
351-
Semantic::Older(Sequence::from_height(42))
352-
]
346+
vec![Semantic::Key(key_a), Semantic::Older(Sequence::from_height(42))]
353347
),
354348
Semantic::Key(key_b)
355349
]

src/policy/semantic.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,7 @@ mod tests {
700700
policy,
701701
Policy::Threshold(
702702
1,
703-
vec![
704-
Policy::Key("".to_owned()),
705-
Policy::Older(Sequence::from_height(1000)),
706-
]
703+
vec![Policy::Key("".to_owned()), Policy::Older(Sequence::from_height(1000)),]
707704
)
708705
);
709706
assert_eq!(policy.relative_timelocks(), vec![1000]);

0 commit comments

Comments
 (0)