diff --git a/crates/codecs/src/jpeg.rs b/crates/codecs/src/jpeg.rs index 90a1b0eed..b8de12bdd 100644 --- a/crates/codecs/src/jpeg.rs +++ b/crates/codecs/src/jpeg.rs @@ -75,14 +75,12 @@ pub(crate) fn parse_markers(b: &[u8]) -> Option { let end = (p + 2 + len).min(b.len()); let seg = &b[start..end]; match marker { - 0xC0..=0xCF if marker != 0xC4 && marker != 0xC8 && marker != 0xCC => { - if seg.len() >= 6 && m.components == 0 { - m.precision = seg[0]; - m.sof = marker; - m.height = u16::from_be_bytes([seg[1], seg[2]]) as u32; - m.width = u16::from_be_bytes([seg[3], seg[4]]) as u32; - m.components = seg[5]; - } + 0xC0..=0xCF if marker != 0xC4 && marker != 0xC8 && marker != 0xCC && seg.len() >= 6 && m.components == 0 => { + m.precision = seg[0]; + m.sof = marker; + m.height = u16::from_be_bytes([seg[1], seg[2]]) as u32; + m.width = u16::from_be_bytes([seg[3], seg[4]]) as u32; + m.components = seg[5]; } 0xE1 => { if seg.starts_with(b"Exif\0\0") && m.exif.is_none() { diff --git a/crates/engine/src/camera_preview.rs b/crates/engine/src/camera_preview.rs index e21c5d2de..c5d0a1956 100644 --- a/crates/engine/src/camera_preview.rs +++ b/crates/engine/src/camera_preview.rs @@ -155,7 +155,7 @@ fn dng_colour(tags: &ColorData, t: &CameraTransform, look: Option<&CameraLook>) // into the baseline exposure let white = m.apply([1.0; 3]); let k = (white[0] + white[1] + white[2]) / 3.0; - if !(k.is_finite() && k > 1e-6) || !t.wb.iter().all(|w| w.is_finite() && *w > 0.0) { + if !(k.is_finite() && k > 1e-6 && t.wb.iter().all(|w| w.is_finite() && *w > 0.0)) { return None; } let m = Mat3(m.0.map(|r| r.map(|v| v / k))); diff --git a/crates/engine/src/media.rs b/crates/engine/src/media.rs index d2b55cbe3..4800f9418 100644 --- a/crates/engine/src/media.rs +++ b/crates/engine/src/media.rs @@ -1554,7 +1554,7 @@ impl crate::Session { /// says and what a smart preview renders with. Only for raws edited in Kelvin. fn learn_as_shot_wb(&mut self, id: PhotoId, info: &SourceInfo) { let Some(p) = self.catalog.photo(id) else { return }; - if !(info.raw && !info.relative_wb && p.develops_raw() && !p.relative_wb()) { + if !info.raw || info.relative_wb || !p.develops_raw() || p.relative_wb() { return; } let read = (info.as_shot_temp, info.as_shot_tint); diff --git a/crates/engine/src/sidecar.rs b/crates/engine/src/sidecar.rs index ec726f7fb..89b476959 100644 --- a/crates/engine/src/sidecar.rs +++ b/crates/engine/src/sidecar.rs @@ -510,10 +510,10 @@ pub fn read_packet(original: &str, kind: MediaKind, naming: SidecarNaming) -> Op /// Photo ids touched by an op (for auto-write). pub(crate) fn op_photos(op: &Op, out: &mut Vec) { match op { - Op::SetRating { id, .. } | Op::SetFlag { id, .. } | Op::SetLabel { id, .. } | Op::SetDevelop { id, .. } | Op::SetMeta { id, .. } => { - if !out.contains(id) { - out.push(*id); - } + Op::SetRating { id, .. } | Op::SetFlag { id, .. } | Op::SetLabel { id, .. } | Op::SetDevelop { id, .. } | Op::SetMeta { id, .. } + if !out.contains(id) => + { + out.push(*id); } Op::Batch { ops } => ops.iter().for_each(|o| op_photos(o, out)), _ => {} diff --git a/crates/faces/src/net/shape.rs b/crates/faces/src/net/shape.rs index d76271bc7..89ffaba7a 100644 --- a/crates/faces/src/net/shape.rs +++ b/crates/faces/src/net/shape.rs @@ -186,11 +186,7 @@ pub(super) fn check(n: &Node, g: &Graph) -> Result<()> { floats(n, g, 2)?; } } - "Dropout" => { - if !(0.0..1.0).contains(&float(n, "ratio", 0.5)) { - return shape_err("Dropout ratio is invalid"); - } - } + "Dropout" if !(0.0..1.0).contains(&float(n, "ratio", 0.5)) => return shape_err("Dropout ratio is invalid"), "MaxPool" => { pair(n, "kernel_shape", 1)?; pair(n, "strides", 1)?; diff --git a/crates/meta/src/gpx.rs b/crates/meta/src/gpx.rs index e63499033..abfc9ebd4 100644 --- a/crates/meta/src/gpx.rs +++ b/crates/meta/src/gpx.rs @@ -114,11 +114,7 @@ pub fn parse_gpx(s: &str) -> Result { match name.as_slice() { b"gpx" if path.is_empty() => seen_gpx = true, b"trk" if parent == Some(b"gpx") => log.tracks += 1, - b"trkseg" if parent == Some(b"trk") => { - if log.points.last().is_some_and(|p| p.segment == segment) { - segment += 1; - } - } + b"trkseg" if parent == Some(b"trk") && log.points.last().is_some_and(|p| p.segment == segment) => segment += 1, b"trkpt" if parent == Some(b"trkseg") => { let mut p = Pending::default(); for a in e.attributes().with_checks(false).flatten() { diff --git a/crates/meta/src/xmp.rs b/crates/meta/src/xmp.rs index 2a4d753dc..924b5fce0 100644 --- a/crates/meta/src/xmp.rs +++ b/crates/meta/src/xmp.rs @@ -252,13 +252,11 @@ fn parse_tree(s: &str) -> Result { stack.push(node); } } - Event::End(_) => { - if stack.len() > 1 { - let n = stack.pop().expect("len > 1"); - scopes.pop(); - if let Some(parent) = stack.last_mut() { - parent.children.push(n); - } + Event::End(_) if stack.len() > 1 => { + let n = stack.pop().expect("len > 1"); + scopes.pop(); + if let Some(parent) = stack.last_mut() { + parent.children.push(n); } } Event::Text(t) => { diff --git a/crates/pipeline/src/local.rs b/crates/pipeline/src/local.rs index a99530777..e46085955 100644 --- a/crates/pipeline/src/local.rs +++ b/crates/pipeline/src/local.rs @@ -147,7 +147,7 @@ pub fn legacy_to_kelvin(temp: f64, tint: f64, as_shot: (f64, f64)) -> (f64, f64) /// edited on a rendered photo or a raw without matrices never pass for Kelvin when pasted onto one that has them. pub fn normalize_wb(d: &mut DevelopSettings, info: &SourceInfo) { use lightcraft_develop::{WbMode, WbScale}; - if !(info.raw && !info.relative_wb) { + if !info.raw || info.relative_wb { d.wb.scale = WbScale::Legacy; return; } diff --git a/xtask/src/layers.rs b/xtask/src/layers.rs index 05a588e31..d5be5523f 100644 --- a/xtask/src/layers.rs +++ b/xtask/src/layers.rs @@ -192,11 +192,8 @@ pub fn check(crates: &[Crate]) -> Vec { match classify(&d.name) { // Unregistered deps are reported on their own entry. None => {} - Some(Class::Testkit) => { - if d.kind != DepKind::Dev { - out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() }); - } - } + Some(Class::Testkit) if d.kind != DepKind::Dev => out.push(Violation::TestkitAsNormalDep { krate: c.name.clone() }), + Some(Class::Testkit) => {} Some(dc) => { let to = dc.layer().unwrap_or(u8::MAX); if to >= layer && !(to == layer && intra_layer_allowed(&c.name, &d.name)) {