Skip to content

A free and open-source video editor for Windows and Linux, written in Rust: a track-based timeline, effects at every level, OpenFX and VST 3 hosts, studio audio and color.

BananaV 0.4.0: loops over the items themselves (clippy 1.100)

Acasob90f41337eba
diff --git a/crates/effects/src/picture_in_picture.rs b/crates/effects/src/picture_in_picture.rs
index f081b79..80beb28 100644
--- a/crates/effects/src/picture_in_picture.rs
+++ b/crates/effects/src/picture_in_picture.rs
@@ -1496,8 +1496,8 @@ mod tests {
scale: [1.0; 2],
..start
};
- for i in 0..4 {
- assert!(near(s.corners[i], turned.quad(ASPECT)[i], 1e-9));
+ for (c, q) in s.corners.iter().zip(turned.quad(ASPECT)) {
+ assert!(near(*c, q, 1e-9));
}
}
diff --git a/crates/effects/src/stabilization.rs b/crates/effects/src/stabilization.rs
index c49d5d3..b2ab25d 100644
--- a/crates/effects/src/stabilization.rs
+++ b/crates/effects/src/stabilization.rs
@@ -2276,13 +2276,9 @@ mod tests {
},
SIZE,
);
- for k in 0..f.numbers.len() {
+ for (k, n) in f.numbers.iter().enumerate() {
let expected = if k % 2 == 1 { 2.0 } else { 0.0 };
- assert!(
- (f.numbers[k][0] - expected).abs() < 1e-6,
- "{k}: {:?}",
- f.numbers[k]
- );
+ assert!((n[0] - expected).abs() < 1e-6, "{k}: {n:?}");
}
// An unticked component stays as filmed.
let mut s = smooth(Model::Similar);
diff --git a/crates/ui-egui/src/grading_curves.rs b/crates/ui-egui/src/grading_curves.rs
index 281dc1c..50f2da5 100644
--- a/crates/ui-egui/src/grading_curves.rs
+++ b/crates/ui-egui/src/grading_curves.rs
@@ -356,9 +356,9 @@ pub fn editor(
egui::Popup::menu(&b)
.close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside)
.show(|ui| {
- for k in 0..n {
+ for (k, on) in view.active.iter_mut().enumerate().take(n) {
let name = labels.get(k).cloned().unwrap_or_default();
- crate::widgets::checkbox(ui, &mut view.active[k], &name);
+ crate::widgets::checkbox(ui, on, &name);
}
});
}
diff --git a/crates/ui-egui/src/modern_eq.rs b/crates/ui-egui/src/modern_eq.rs
index bfa4723..a8fc9e8 100644
--- a/crates/ui-egui/src/modern_eq.rs
+++ b/crates/ui-egui/src/modern_eq.rs
@@ -930,11 +930,11 @@ fn paint_graph(
fn toolbar(ui: &mut Ui, view: &mut View, s: &mut Settings) {
ui.horizontal(|ui| {
ui.spacing_mut().item_spacing.x = 4.0;
- for b in 0..eq::BANDS {
- if !s.bands[b].used {
+ for (b, slot) in s.bands.iter_mut().enumerate().take(eq::BANDS) {
+ if !slot.used {
continue;
}
- let band = s.bands[b];
+ let band = *slot;
let (rect, resp) = ui.allocate_exact_size(CHIP, Sense::click());
resp.widget_info(|| {
egui::WidgetInfo::labeled(egui::WidgetType::Button, true, trf!("Band {}", b + 1))
@@ -945,7 +945,7 @@ fn toolbar(ui: &mut Ui, view: &mut View, s: &mut Settings) {
.interact_pointer_pos()
.is_some_and(|p| p.x < rect.left() + 18.0);
if on_dot {
- s.bands[b].on = !band.on;
+ slot.on = !band.on;
} else {
view.picked = Some(b);
}