EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust
Lint: clippy's collapsible_match passes on Rust 1.95
tylerjenningsw75cc264ccffc
diff --git a/crates/effects/src/audio_fx.rs b/crates/effects/src/audio_fx.rsindex a5e1fc4e3..cd9153d66 100644--- a/crates/effects/src/audio_fx.rs+++ b/crates/effects/src/audio_fx.rs@@ -245,10 +245,8 @@ pub fn process(id: &str, params: &Params, buf: &mut [f32], rate: u32, start: f64}let sr = rate as f64;match id {- "ec.audio.backwards" => {- if params.b("swapChannels") {- buf.as_chunks_mut::<2>().0.iter_mut().for_each(|f| f.swap(0, 1));- }+ "ec.audio.backwards" if params.b("swapChannels") => {+ buf.as_chunks_mut::<2>().0.iter_mut().for_each(|f| f.swap(0, 1));}"ec.audio.basstreble" => {let bass = params.f("bass") / 100.0 * 12.0;diff --git a/crates/effects/src/generate3.rs b/crates/effects/src/generate3.rsindex 926846a9b..81797d9cb 100644--- a/crates/effects/src/generate3.rs+++ b/crates/effects/src/generate3.rs@@ -503,10 +503,8 @@ fn scan_runs(polys: &[(Vec<[f64; 2]>, bool, bool)], fill: u32, ew: f64, d: [f64;let entering = k % 2 == 0;let l = ew / sin;match mode {- 0 => {- if entering && k + 1 < xs.len() {- out.push((t, xs[k + 1].0));- }+ 0 if entering && k + 1 < xs.len() => {+ out.push((t, xs[k + 1].0));}1 => out.push((t - l * 0.5, t + l * 0.5)),2 => out.push(if entering { (t, t + l) } else { (t - l, t) }),diff --git a/crates/pdf/src/color.rs b/crates/pdf/src/color.rsindex 019121e0a..6943476bc 100644--- a/crates/pdf/src/color.rs+++ b/crates/pdf/src/color.rs@@ -221,11 +221,9 @@ fn ps_parse(lx: &mut crate::object::Lexer, depth: usize) -> Vec<PsOp> {match o {Obj::Num(n) => out.push(PsOp::Num(n)),Obj::Bool(b) => out.push(PsOp::Num(if b { 1.0 } else { 0.0 })),- Obj::Op(op) if op == "{" => {- if depth < 32 {- out.push(PsOp::Proc(ps_parse(lx, depth + 1)));- }- }+ Obj::Op(op) if op == "{" && depth < 32 => out.push(PsOp::Proc(ps_parse(lx, depth + 1))),+ // Nested too deep: skip the procedure's opening brace (never push it as an operator).+ Obj::Op(op) if op == "{" => {}Obj::Op(op) if op == "}" => return out,Obj::Op(op) => out.push(PsOp::Op(op)),_ => {}diff --git a/crates/pdf/src/page.rs b/crates/pdf/src/page.rsindex 94f629335..13e98b3c9 100644--- a/crates/pdf/src/page.rs+++ b/crates/pdf/src/page.rs@@ -313,11 +313,9 @@ impl<'a> Interp<'a> {self.path.curve_to(Point::new(n(0), n(1)), p, p);self.cur = Some(p);}- "h" => {- if self.cur.is_some() {- self.path.close_path();- self.cur = self.start;- }+ "h" if self.cur.is_some() => {+ self.path.close_path();+ self.cur = self.start;}"re" => {let (x, y, w, h) = (n(0), n(1), n(2), n(3));diff --git a/crates/psd/src/lib.rs b/crates/psd/src/lib.rsindex 422c3153c..1c0fd3d4d 100644--- a/crates/psd/src/lib.rs+++ b/crates/psd/src/lib.rs@@ -656,10 +656,8 @@ impl Psd {let gamma = r.f32()? as f64;l.adjustment = Some(Adjustment::Exposure { exposure, offset, gamma });}- b"curv" | b"blnc" | b"post" | b"thrs" | b"selc" | b"mixr" | b"phfl" | b"vibA" | b"blwh" | b"grdm" | b"clrL" => {- if l.adjustment.is_none() {- l.adjustment = Some(Adjustment::Other(String::from_utf8_lossy(key).into_owned()));- }+ b"curv" | b"blnc" | b"post" | b"thrs" | b"selc" | b"mixr" | b"phfl" | b"vibA" | b"blwh" | b"grdm" | b"clrL" if l.adjustment.is_none() => {+ l.adjustment = Some(Adjustment::Other(String::from_utf8_lossy(key).into_owned()));}b"SoLd" | b"SoLE" => {let _id = r.tag()?;diff --git a/crates/render/src/masks.rs b/crates/render/src/masks.rsindex 980e64751..f36c6d9ea 100644--- a/crates/render/src/masks.rs+++ b/crates/render/src/masks.rs@@ -114,10 +114,8 @@ pub fn shapes(ctx: &EvalCtx, layer: &Layer) -> Vec<effectcraft_effects::MaskShaplet mut pts: Vec<[f64; 2]> = Vec::new();let mut closed = false;kurbo::flatten(path.iter(), 0.25, |el| match el {- effectcraft_path::PathEl::MoveTo(p) | effectcraft_path::PathEl::LineTo(p) => {- if pts.last() != Some(&[p.x, p.y]) {- pts.push([p.x, p.y]);- }+ effectcraft_path::PathEl::MoveTo(p) | effectcraft_path::PathEl::LineTo(p) if pts.last() != Some(&[p.x, p.y]) => {+ pts.push([p.x, p.y]);}effectcraft_path::PathEl::ClosePath => closed = true,_ => {}diff --git a/crates/text/src/path_text.rs b/crates/text/src/path_text.rsindex 5c2b4338b..85cab0719 100644--- a/crates/text/src/path_text.rs+++ b/crates/text/src/path_text.rs@@ -32,10 +32,8 @@ impl PathMeasure {pts.push(p);}}- PathEl::LineTo(p) => {- if pts.last().is_none_or(|q| q.distance(p) > 1e-9) {- pts.push(p);- }+ PathEl::LineTo(p) if pts.last().is_none_or(|q| q.distance(p) > 1e-9) => {+ pts.push(p);}PathEl::ClosePath => {closed = true;