Skip to content

Commit 738ff15

Browse files
committed
Remove redundant closures
Clippy emits a bunch of warnings of form: warning: redundant closure As suggested, remove the redundant closures and just pass in the function.
1 parent 63dee9e commit 738ff15

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/descriptor/key.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ impl<K: InnerXKey> DescriptorXKey<K> {
562562
DescriptorKeyParseError("Malformed master fingerprint, expected 8 hex chars")
563563
})?;
564564
let origin_path = raw_origin
565-
.map(|p| bip32::ChildNumber::from_str(p))
565+
.map(bip32::ChildNumber::from_str)
566566
.collect::<Result<bip32::DerivationPath, bip32::Error>>()
567567
.map_err(|_| {
568568
DescriptorKeyParseError("Error while parsing master derivation path")

src/interpreter/inner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ pub(super) fn from_txdata<'txin>(
233233
let ctrl_blk = wit_stack.pop().ok_or(Error::UnexpectedStackEnd)?;
234234
let ctrl_blk = ctrl_blk.as_push()?;
235235
let tap_script = wit_stack.pop().ok_or(Error::UnexpectedStackEnd)?;
236-
let ctrl_blk = ControlBlock::from_slice(ctrl_blk)
237-
.map_err(|e| Error::ControlBlockParse(e))?;
236+
let ctrl_blk =
237+
ControlBlock::from_slice(ctrl_blk).map_err(Error::ControlBlockParse)?;
238238
let tap_script = script_from_stackelem::<Tap>(&tap_script)?;
239239
let ms = tap_script.to_no_checks_ms();
240240
// Creating new contexts is cheap

src/miniscript/astelem.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ where
555555

556556
let subs: Result<Vec<Arc<Miniscript<Pk, Ctx>>>, _> = top.args[1..]
557557
.iter()
558-
.map(|sub| expression::FromTree::from_tree(sub))
558+
.map(expression::FromTree::from_tree)
559559
.collect();
560560

561561
Ok(Terminal::Thresh(k, subs?))

src/policy/concrete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ where
571571
("TRIVIAL", 0) => Ok(Policy::Trivial),
572572
("pk", 1) => expression::terminal(&top.args[0], |pk| Pk::from_str(pk).map(Policy::Key)),
573573
("after", 1) => {
574-
let num = expression::terminal(&top.args[0], |x| expression::parse_num(x))?;
574+
let num = expression::terminal(&top.args[0], expression::parse_num)?;
575575
if num > 2u32.pow(31) {
576576
return Err(Error::PolicyError(PolicyError::TimeTooFar));
577577
} else if num == 0 {
@@ -580,7 +580,7 @@ where
580580
Ok(Policy::After(num))
581581
}
582582
("older", 1) => {
583-
let num = expression::terminal(&top.args[0], |x| expression::parse_num(x))?;
583+
let num = expression::terminal(&top.args[0], expression::parse_num)?;
584584
if num > 2u32.pow(31) {
585585
return Err(Error::PolicyError(PolicyError::TimeTooFar));
586586
} else if num == 0 {

0 commit comments

Comments
 (0)