Skip to content

Commit a8c156e

Browse files
committed
Use map instead of and_then
clippy emits: error: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)` As suggested, use `map` combinator.
1 parent d5662da commit a8c156e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/policy/compiler.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ mod tests {
15671567
(1, Arc::new(Concrete::Thresh(keys_b.len(), keys_b))),
15681568
])
15691569
.compile();
1570-
let script_size = thresh_res.clone().and_then(|m| Ok(m.script_size()));
1570+
let script_size = thresh_res.clone().map(|m| m.script_size());
15711571
assert_eq!(
15721572
thresh_res,
15731573
Err(CompilerError::LimitsExceeded),
@@ -1584,7 +1584,7 @@ mod tests {
15841584
let thresh_res: Result<SegwitMiniScript, _> = Concrete::Thresh(keys.len(), keys).compile();
15851585
let n_elements = thresh_res
15861586
.clone()
1587-
.and_then(|m| Ok(m.max_satisfaction_witness_elements()));
1587+
.map(|m| m.max_satisfaction_witness_elements());
15881588
assert_eq!(
15891589
thresh_res,
15901590
Err(CompilerError::LimitsExceeded),
@@ -1603,7 +1603,7 @@ mod tests {
16031603
.collect();
16041604
let thresh_res: Result<SegwitMiniScript, _> =
16051605
Concrete::Thresh(keys.len() - 1, keys).compile();
1606-
let ops_count = thresh_res.clone().and_then(|m| Ok(m.ext.ops.op_count()));
1606+
let ops_count = thresh_res.clone().map(|m| m.ext.ops.op_count());
16071607
assert_eq!(
16081608
thresh_res,
16091609
Err(CompilerError::LimitsExceeded),

0 commit comments

Comments
 (0)