From a3c2f2e299db18300608f8f3c94fb3dee876bce2 Mon Sep 17 00:00:00 2001 From: Tanish Manku Date: Wed, 11 Nov 2026 00:49:15 -0700 Subject: [PATCH] Fix main: clippy after the 11-11 merges - io: drop the no-op drop(tick) in psd_export (clippy::drop_non_drop). - automation: split the Windows UNC helper test from #10323 into three, each under the cognitive-complexity limit. - ui-egui: RangeInclusive::contains in the pen cursor and the dash test. --- crates/automation/src/workspace/tests.rs | 18 +++++++++++++++++- crates/io/src/psd_export/document.rs | 1 - crates/ui-egui/src/canvas/paint.rs | 2 +- crates/ui-egui/src/canvas/tool_cursor/pen.rs | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/crates/automation/src/workspace/tests.rs b/crates/automation/src/workspace/tests.rs index 219ca6c9b4..59bd768bc5 100644 --- a/crates/automation/src/workspace/tests.rs +++ b/crates/automation/src/workspace/tests.rs @@ -449,7 +449,7 @@ fn windows_unc_root_writes_and_exports_when_supported() { #[cfg(windows)] #[test] fn windows_handle_relative_helpers_match_the_capability_operations() { - let (inside, outside, workspace) = roots("unc-helpers"); + let (inside, _outside, workspace) = roots("unc-helpers"); let root = workspace.write.as_ref().unwrap(); assert!(!is_unc_root(root)); @@ -464,7 +464,15 @@ fn windows_handle_relative_helpers_match_the_capability_operations() { std::fs::create_dir(inside.join("dir")).unwrap(); assert!(delete_on_close(&root.dir, Path::new("dir")).is_err()); assert!(inside.join("dir").is_dir()); +} +/// The ambient rename that stands in for the capability's below a UNC root (#10317). +#[cfg(windows)] +#[test] +fn windows_rename_unc_matches_the_capability_rename() { + let (inside, outside, workspace) = roots("unc-rename"); + let root = workspace.write.as_ref().unwrap(); + std::fs::create_dir(inside.join("dir")).unwrap(); // The ambient rename on the canonical root path behaves like the capability's: it creates, // replaces a file, replaces a link instead of writing through it, and refuses a directory. std::fs::write(inside.join("plain.tmp"), b"the longer first version").unwrap(); @@ -487,7 +495,15 @@ fn windows_handle_relative_helpers_match_the_capability_operations() { assert_eq!(std::fs::read(outside.join("target.png")).unwrap(), b"outside"); } let _ = std::fs::remove_file(inside.join("plain.tmp")); +} +/// The directory walk that stands in for the capability's `create_dir_all` below a UNC root +/// (#10317) creates, refuses files on the way and never follows a junction outside. +#[cfg(windows)] +#[test] +fn windows_create_dir_all_unc_matches_the_capability_operation() { + let (inside, outside, workspace) = roots("unc-dirs"); + let root = workspace.write.as_ref().unwrap(); create_dir_all_unc(root, Path::new("a/b/c")).unwrap(); assert!(inside.join("a/b/c").is_dir()); create_dir_all_unc(root, Path::new("a/b/c")).unwrap(); diff --git a/crates/io/src/psd_export/document.rs b/crates/io/src/psd_export/document.rs index f4a118b003..fb09a54ffc 100644 --- a/crates/io/src/psd_export/document.rs +++ b/crates/io/src/psd_export/document.rs @@ -127,7 +127,6 @@ fn export_supported_document( }; let space = photocraft_compose::cmyk_space(doc); photocraft_color::convert::with_cmyk_space(space.as_ref(), || ex.emit(&doc.layers, &mut tick)); - drop(tick); ctl.progress(layers_share); let merged = prepare_merged_planes(doc, &mut ex, opts, ctl, fmt, duotone_inks.is_some(), layers_share); diff --git a/crates/ui-egui/src/canvas/paint.rs b/crates/ui-egui/src/canvas/paint.rs index 07e507d935..af38b54dbc 100644 --- a/crates/ui-egui/src/canvas/paint.rs +++ b/crates/ui-egui/src/canvas/paint.rs @@ -741,7 +741,7 @@ mod clip_segment_tests { assert!(!starts.is_empty(), "the view at {left} shows dashes"); for d in starts { let off = d % (2.0 * DASH); - assert!(off < 0.01 || off > 2.0 * DASH - 0.01, "view at {left}: a dash starts {d} from the corner, off the pattern by {off}"); + assert!(!(0.01..=2.0 * DASH - 0.01).contains(&off), "view at {left}: a dash starts {d} from the corner, off the pattern by {off}"); } } } diff --git a/crates/ui-egui/src/canvas/tool_cursor/pen.rs b/crates/ui-egui/src/canvas/tool_cursor/pen.rs index fc7d968af4..302f92e8c2 100644 --- a/crates/ui-egui/src/canvas/tool_cursor/pen.rs +++ b/crates/ui-egui/src/canvas/tool_cursor/pen.rs @@ -92,7 +92,7 @@ pub fn rasterize(variant: PenVariant, scale: f32) -> Option { return None; } let icon_px_f = (LOGICAL_SIZE * scale).round(); - if icon_px_f < 1.0 || icon_px_f > 512.0 { + if !(1.0..=512.0).contains(&icon_px_f) { return None; } let icon_px = icon_px_f as u32;