Skip to content

Commit 22ce32a

Browse files
committed
clippy: non-lifetime stuff
1 parent 9efc345 commit 22ce32a

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

src/miniscript/analyzable.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ use crate::{Miniscript, MiniscriptKey, ScriptContext, Terminal};
1717
///
1818
/// This allows parsing miniscripts if
1919
/// 1. It is unsafe(does not require a digital signature to spend it)
20-
/// 2. It contains a unspendable path because of either
21-
/// a. Resource limitations
22-
/// b. Timelock Mixing
23-
/// 3. The script is malleable and thereby some of satisfaction weight
24-
/// guarantees are not satisfied.
20+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
21+
/// 3. The script is malleable and thereby some of satisfaction weight guarantees are not satisfied.
2522
/// 4. It has repeated public keys
2623
/// 5. raw pkh fragments without the pk. This could be obtained when parsing miniscript from script
2724
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Default, Hash)]
@@ -123,11 +120,8 @@ impl ExtParams {
123120
/// Possible reasons Miniscript guarantees can fail
124121
/// We currently mark Miniscript as Non-Analyzable if
125122
/// 1. It is unsafe(does not require a digital signature to spend it)
126-
/// 2. It contains a unspendable path because of either
127-
/// a. Resource limitations
128-
/// b. Timelock Mixing
129-
/// 3. The script is malleable and thereby some of satisfaction weight
130-
/// guarantees are not satisfied.
123+
/// 2. It contains a unspendable path because of either resource limitations or timelock mixing.
124+
/// 3. The script is malleable and thereby some of satisfaction weight guarantees are not satisfied.
131125
/// 4. It has repeated publickeys
132126
#[derive(Debug, PartialEq)]
133127
pub enum AnalysisError {

src/miniscript/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ impl<Ctx: ScriptContext> Miniscript<Ctx::Key, Ctx> {
378378
/// The type information and extra properties are implied by the AST.
379379
impl<Pk: MiniscriptKey, Ctx: ScriptContext> PartialOrd for Miniscript<Pk, Ctx> {
380380
fn partial_cmp(&self, other: &Miniscript<Pk, Ctx>) -> Option<cmp::Ordering> {
381-
Some(self.node.cmp(&other.node))
381+
Some(self.cmp(other))
382382
}
383383
}
384384

src/policy/compiler.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,13 +671,10 @@ fn insert_elem<Pk: MiniscriptKey, Ctx: ScriptContext>(
671671
// Check whether the new element is worse than any existing element. If there
672672
// is an element which is a subtype of the current element and has better
673673
// cost, don't consider this element.
674-
let is_worse = map
675-
.iter()
676-
.map(|(existing_key, existing_elem)| {
677-
let existing_elem_cost = existing_elem.cost_1d(sat_prob, dissat_prob);
678-
existing_key.is_subtype(elem_key) && existing_elem_cost <= elem_cost
679-
})
680-
.any(|x| x);
674+
let is_worse = map.iter().any(|(existing_key, existing_elem)| {
675+
let existing_elem_cost = existing_elem.cost_1d(sat_prob, dissat_prob);
676+
existing_key.is_subtype(elem_key) && existing_elem_cost <= elem_cost
677+
});
681678
if !is_worse {
682679
// If the element is not worse any element in the map, remove elements
683680
// whose subtype is the current element and have worse cost.

0 commit comments

Comments
 (0)