Skip to content

Commit d8a84ba

Browse files
committed
Use an iterator to iterate over casts
Clippy emits: warning: the loop variable `i` is only used to index `casts` As suggested, use an iterator.
1 parent f34c80a commit d8a84ba

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/policy/compiler.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ fn insert_elem_closure<Pk: MiniscriptKey, Ctx: ScriptContext>(
700700
while !cast_stack.is_empty() {
701701
let current = cast_stack.pop_front().unwrap();
702702

703-
for i in 0..casts.len() {
704-
if let Ok(new_ext) = casts[i].cast(&current) {
703+
for c in &casts {
704+
if let Ok(new_ext) = c.cast(&current) {
705705
if insert_elem(map, new_ext.clone(), sat_prob, dissat_prob) {
706706
cast_stack.push_back(new_ext);
707707
}
@@ -732,9 +732,9 @@ fn insert_best_wrapped<Pk: MiniscriptKey, Ctx: ScriptContext>(
732732
if dissat_prob.is_some() {
733733
let casts: [Cast<Pk, Ctx>; 10] = all_casts::<Pk, Ctx>();
734734

735-
for i in 0..casts.len() {
735+
for c in casts {
736736
for x in best_compilations(policy_cache, policy, sat_prob, None)?.values() {
737-
if let Ok(new_ext) = casts[i].cast(x) {
737+
if let Ok(new_ext) = c.cast(x) {
738738
insert_elem_closure(map, new_ext, sat_prob, dissat_prob);
739739
}
740740
}

0 commit comments

Comments
 (0)