Format the tree the way the gate asks for it
`cargo fmt --check` is a required step and had drifted across 45 files. Most of it arrived this week: several operations were written in parallel worktrees and merged by hand, and a hand-merge resolves conflicts without ever running the formatter over the result. No behaviour changes — this is `cargo fmt --all` and nothing else, kept as its own commit so the next reader can skip it wholesale rather than search it for one that matters. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -487,7 +487,8 @@ mod tests {
|
||||
// And the last span is shallower than the one before it, which is
|
||||
// what a shoulder *is*. Without one the curve clips highlights
|
||||
// harder than the linear rendering did.
|
||||
let slope = |i: usize| (curve.ys[i + 1] - curve.ys[i]) / (curve.xs[i + 1] - curve.xs[i]);
|
||||
let slope =
|
||||
|i: usize| (curve.ys[i + 1] - curve.ys[i]) / (curve.xs[i + 1] - curve.xs[i]);
|
||||
assert!(
|
||||
slope(POINTS - 2) < slope(POINTS - 3),
|
||||
"{name} has no highlight shoulder"
|
||||
@@ -502,13 +503,7 @@ mod tests {
|
||||
// as a dark halo in a gradient, which reads as a rendering fault
|
||||
// rather than as a bad profile.
|
||||
assert_eq!(
|
||||
BaseCurve::from_points(&[
|
||||
[0.0, 0.0],
|
||||
[0.25, 0.4],
|
||||
[0.5, 0.3],
|
||||
[0.75, 0.8],
|
||||
[1.0, 1.0]
|
||||
]),
|
||||
BaseCurve::from_points(&[[0.0, 0.0], [0.25, 0.4], [0.5, 0.3], [0.75, 0.8], [1.0, 1.0]]),
|
||||
None
|
||||
);
|
||||
}
|
||||
@@ -540,13 +535,7 @@ mod tests {
|
||||
// point above 1.0 would put the shoulder outside the range the curve
|
||||
// is defined over and silently flatten everything below it.
|
||||
assert_eq!(
|
||||
BaseCurve::from_points(&[
|
||||
[0.0, 0.0],
|
||||
[0.25, 0.3],
|
||||
[0.5, 1.4],
|
||||
[0.75, 1.5],
|
||||
[1.0, 1.6]
|
||||
]),
|
||||
BaseCurve::from_points(&[[0.0, 0.0], [0.25, 0.3], [0.5, 1.4], [0.75, 1.5], [1.0, 1.6]]),
|
||||
None
|
||||
);
|
||||
}
|
||||
|
||||
@@ -375,7 +375,10 @@ fn rawler_location(gps: &rawler::exif::ExifGPS) -> Option<Location> {
|
||||
(r.d != 0).then(|| r.n as f64 / r.d as f64)
|
||||
}
|
||||
|
||||
fn degrees(dms: &[rawler::formats::tiff::Rational; 3], reference: Option<&String>) -> Option<f64> {
|
||||
fn degrees(
|
||||
dms: &[rawler::formats::tiff::Rational; 3],
|
||||
reference: Option<&String>,
|
||||
) -> Option<f64> {
|
||||
let d = ratio(&dms[0])? + ratio(&dms[1])? / 60.0 + ratio(&dms[2])? / 3600.0;
|
||||
// South and west are stored as positive magnitudes with a letter.
|
||||
let negative = matches!(
|
||||
@@ -534,7 +537,10 @@ pub fn decode(bytes: &[u8]) -> Result<RawImage, DecodeError> {
|
||||
// both callers ask the same object for it.
|
||||
let profile = profile::CameraProfile::extract(&image, &dng);
|
||||
let color_matrix = profile.as_ref().and_then(|p| p.cam_to_srgb());
|
||||
let wb_coeffs = sane_wb(image.wb_coeffs, profile.as_ref().map(|p| p.xyz_to_cam()).as_ref());
|
||||
let wb_coeffs = sane_wb(
|
||||
image.wb_coeffs,
|
||||
profile.as_ref().map(|p| p.xyz_to_cam()).as_ref(),
|
||||
);
|
||||
|
||||
// The rendering half of the profile (FR-DEV-3e). rawler's cleaned strings
|
||||
// are preferred where it has them — they are what the shipped database is
|
||||
|
||||
@@ -678,7 +678,8 @@ fn read_gps_entries(r: &TiffReader, entries: &[Entry]) -> Option<dr_types::Locat
|
||||
// still writes the entry.
|
||||
let degrees = |tag: u16, ref_tag: u16| -> Option<f64> {
|
||||
let e = find(tag)?;
|
||||
let d = r.rational(e, 0)? + r.rational(e, 1).unwrap_or(0.0) / 60.0
|
||||
let d = r.rational(e, 0)?
|
||||
+ r.rational(e, 1).unwrap_or(0.0) / 60.0
|
||||
+ r.rational(e, 2).unwrap_or(0.0) / 3600.0;
|
||||
// The magnitude is unsigned; the hemisphere is a letter beside it.
|
||||
let south_or_west = find(ref_tag)
|
||||
@@ -1412,7 +1413,9 @@ pub fn defects(tiff_data: &[u8]) -> Defects {
|
||||
/// skip one this build does not implement rather than abandoning the list —
|
||||
/// and lists mixing a warp with a defect map are ordinary.
|
||||
fn read_opcode_list(bytes: &[u8], out: &mut Defects) {
|
||||
let Some(count) = be_u32(bytes, 0) else { return };
|
||||
let Some(count) = be_u32(bytes, 0) else {
|
||||
return;
|
||||
};
|
||||
// A sensor has a handful of opcodes, not thousands. A huge count is a
|
||||
// corrupt or hostile file.
|
||||
if count > 256 {
|
||||
|
||||
@@ -1048,7 +1048,11 @@ mod tests {
|
||||
// would render black, which is much harder to diagnose than
|
||||
// uncalibrated.
|
||||
assert!(!usable(&[[0.0; 3]; 3]));
|
||||
assert!(!usable(&[[f32::NAN, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]));
|
||||
assert!(!usable(&[
|
||||
[f32::NAN, 0.0, 0.0],
|
||||
[0.0, 1.0, 0.0],
|
||||
[0.0, 0.0, 1.0]
|
||||
]));
|
||||
assert!(usable(&SIX_D_D65));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user