Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy: remove .any(|x| x) construction in the compiler #768

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/policy/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,10 @@ fn insert_elem<Pk: MiniscriptKey, Ctx: ScriptContext>(
// Check whether the new element is worse than any existing element. If there
// is an element which is a subtype of the current element and has better
// cost, don't consider this element.
let is_worse = map
.iter()
.map(|(existing_key, existing_elem)| {
let existing_elem_cost = existing_elem.cost_1d(sat_prob, dissat_prob);
existing_key.is_subtype(elem_key) && existing_elem_cost <= elem_cost
})
.any(|x| x);
let is_worse = map.iter().any(|(existing_key, existing_elem)| {
let existing_elem_cost = existing_elem.cost_1d(sat_prob, dissat_prob);
existing_key.is_subtype(elem_key) && existing_elem_cost <= elem_cost
});
if !is_worse {
// If the element is not worse any element in the map, remove elements
// whose subtype is the current element and have worse cost.
Expand Down
Loading