Clippy: a named type for the preview request, needless borrows of the context

This commit is contained in:
aiongg committed 2026-11-27 15:19:10 +00:00
1 parent e7767a86c2
commit ebc40ce3c9
3 files changed
+6 -3

No files matched your search

+4 -1
View File
@@ -48,10 +48,13 @@ fn adjust_request(app: &PhotocraftApp) -> Option<(craft::ui::dialog::DialogId, S
Some((open.id, cmd, params))
}
/// An open preview dialog's request: the dialog, its command and its parameters.
type PreviewRequest = (craft::ui::dialog::DialogId, String, String);
/// What the canvas shows of an open filter or adjustment dialog's preview, for the document area's version
/// (`region_versions::canvas`): the request the dialog asks for (its fields change with no command) and the result
/// on screen, with whether OK's job is running.
pub(crate) fn canvas_key(app: &PhotocraftApp) -> (Option<(craft::ui::dialog::DialogId, String, String)>, Option<(usize, bool)>) {
pub(crate) fn canvas_key(app: &PhotocraftApp) -> (Option<PreviewRequest>, Option<(usize, bool)>) {
let request = adjust_request(app).map(|(id, command, params)| (id, command, params.to_string()));
let shown = app.filter_preview.as_ref().map(|p| (p.result.as_ref().map_or(0, |doc| std::sync::Arc::as_ptr(doc) as usize), p.committing));
(request, shown)
+1 -1
View File
@@ -185,7 +185,7 @@ pub(crate) fn update(app: &mut PhotocraftApp, at: Option<[f64; 2]>, pressed: boo
}
let resting = f.shown.is_none() && !missed && now - f.since < DEBOUNCE;
if resting {
craft::ui::runtime::frame::request_repaint_after(&ctx, DEBOUNCE - (now - f.since));
craft::ui::runtime::frame::request_repaint_after(ctx, DEBOUNCE - (now - f.since));
}
#[cfg(test)]
let busy = f.job.is_some() || resting;
+1 -1
View File
@@ -375,7 +375,7 @@ pub(crate) fn wake(app: &mut PhotocraftApp, ctx: &egui::Context) {
p.ctx = Some(ctx.clone());
}
if p.running.is_some() {
craft::ui::runtime::frame::request_repaint_after(&ctx, std::time::Duration::from_millis(POLL_MS).as_secs_f64());
craft::ui::runtime::frame::request_repaint_after(ctx, std::time::Duration::from_millis(POLL_MS).as_secs_f64());
}
}