Emit floats an f32 can hold, and drop the format! that formats nothing
CI runs cargo fmt --check and clippy -D warnings, and this branch had never been through either. Both would have failed it. The bulk was the generated colour tables: eight significant figures where an f32 carries about 7.2, so the eighth is noise that rounds away at compile time and clippy's excessive_precision says so 109 times over. Fixed in the generator rather than only in the file, so it stays fixed -- and the file is trimmed in place rather than re-derived, because regenerating it needs a colour-science stack that has nothing to do with the defect. The format! in the composer is mine too, from extracting the rendering tail: the braces in it were escaped because the text used to live inside a larger template, and once extracted the escapes are noise and the call formats nothing. Also here, and clearly not mine: an unused import and a shadowed binding in dr-gpu, and an unused import in a test. They are pre-existing -- clippy has been failing on master before this branch existed, on lints like is_multiple_of that arrived with a toolchain rather than with anyone's code. Fixed because CI cannot go green around them, and called out because a merge commit is a bad place to quietly edit someone else's crate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+20
-12
@@ -2350,9 +2350,7 @@ impl DevelopSession {
|
||||
/// filter asks about the stage rather than the support.
|
||||
pub fn film_choices() -> Vec<(Option<&'static str>, String)> {
|
||||
let mut out = vec![(None, "None".to_string())];
|
||||
out.extend(
|
||||
dr_film::camera_stocks().map(|p| (Some(p.stock.as_str()), p.name.clone())),
|
||||
);
|
||||
out.extend(dr_film::camera_stocks().map(|p| (Some(p.stock.as_str()), p.name.clone())));
|
||||
out
|
||||
}
|
||||
|
||||
@@ -2382,18 +2380,28 @@ impl DevelopSession {
|
||||
// Only a negative has a paper. Asking to print a reversal stock is not
|
||||
// an error to report, it is a request that has no meaning — so it is
|
||||
// quietly the same as not asking.
|
||||
let paper = if print { dr_film::default_print(profile) } else { None };
|
||||
let paper = if print {
|
||||
dr_film::default_print(profile)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let baked = dr_film::bake(&dr_film::Recipe {
|
||||
film: profile,
|
||||
print: paper,
|
||||
exposure_ev: self.graph.param(
|
||||
dr_pipeline::ops::film_sim::ID,
|
||||
dr_pipeline::ops::film_sim::EXPOSURE,
|
||||
).unwrap_or(0.0),
|
||||
print_exposure_ev: self.graph.param(
|
||||
dr_pipeline::ops::film_sim::ID,
|
||||
dr_pipeline::ops::film_sim::PRINT_EXPOSURE,
|
||||
).unwrap_or(0.0),
|
||||
exposure_ev: self
|
||||
.graph
|
||||
.param(
|
||||
dr_pipeline::ops::film_sim::ID,
|
||||
dr_pipeline::ops::film_sim::EXPOSURE,
|
||||
)
|
||||
.unwrap_or(0.0),
|
||||
print_exposure_ev: self
|
||||
.graph
|
||||
.param(
|
||||
dr_pipeline::ops::film_sim::ID,
|
||||
dr_pipeline::ops::film_sim::PRINT_EXPOSURE,
|
||||
)
|
||||
.unwrap_or(0.0),
|
||||
});
|
||||
|
||||
self.set_film(Some(dr_pipeline::graph::Film {
|
||||
|
||||
+9
-5
@@ -518,17 +518,21 @@ fn apply_when_ready(
|
||||
pub(crate) fn sync_film(window: &AppWindow, session: &Rc<RefCell<Option<DevelopSession>>>) {
|
||||
let choices = DevelopSession::film_choices();
|
||||
|
||||
let chosen = session.borrow().as_ref().and_then(|s| {
|
||||
s.film()
|
||||
.map(|(stock, print)| (stock.to_string(), print))
|
||||
});
|
||||
let chosen = session
|
||||
.borrow()
|
||||
.as_ref()
|
||||
.and_then(|s| s.film().map(|(stock, print)| (stock.to_string(), print)));
|
||||
|
||||
// A stock this build has no profile for leaves the picker on "None" rather
|
||||
// than inventing an entry for it. The sidecar still carries the name — it
|
||||
// is only the *control* that cannot show what it does not have.
|
||||
let selected = chosen
|
||||
.as_ref()
|
||||
.and_then(|(stock, _)| choices.iter().position(|(id, _)| *id == Some(stock.as_str())))
|
||||
.and_then(|(stock, _)| {
|
||||
choices
|
||||
.iter()
|
||||
.position(|(id, _)| *id == Some(stock.as_str()))
|
||||
})
|
||||
.unwrap_or(0);
|
||||
|
||||
let can_print = choices
|
||||
|
||||
@@ -3120,8 +3120,7 @@ pub fn read_ids_span(
|
||||
/// Named rather than repeated so the three readers cannot drift — and so that
|
||||
/// the one column that is *not* here stays conspicuous. See
|
||||
/// [`attach_file_ids`] for why the server's file id is fetched separately.
|
||||
const CELL_COLUMNS: &str =
|
||||
"i.id, i.source_ref, i.file_size, i.metadata_state, i.captured_at";
|
||||
const CELL_COLUMNS: &str = "i.id, i.source_ref, i.file_size, i.metadata_state, i.captured_at";
|
||||
|
||||
/// Shared row mapping, so the scoped and unscoped queries cannot drift.
|
||||
///
|
||||
|
||||
@@ -277,15 +277,16 @@ pub fn save_open_edit(
|
||||
// note above gives: they are one edit, and a stock read from a
|
||||
// session that had already moved on would be a different
|
||||
// photograph's.
|
||||
s.film().map(|(stock, print)| dr_pipeline::sidecar::FilmRef {
|
||||
stock: stock.to_string(),
|
||||
print: print.then(|| {
|
||||
dr_film::find(stock)
|
||||
.and_then(dr_film::default_print)
|
||||
.map(|p| p.stock.clone())
|
||||
.unwrap_or_default()
|
||||
s.film()
|
||||
.map(|(stock, print)| dr_pipeline::sidecar::FilmRef {
|
||||
stock: stock.to_string(),
|
||||
print: print.then(|| {
|
||||
dr_film::find(stock)
|
||||
.and_then(dr_film::default_print)
|
||||
.map(|p| p.stock.clone())
|
||||
.unwrap_or_default()
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
)
|
||||
}) else {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user