mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
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.
This commit is contained in:
1 parent
71aad480b6
commit
a3c2f2e299
4 files changed
+19
-4
No files matched your search
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ pub fn rasterize(variant: PenVariant, scale: f32) -> Option<CustomCursorImage> {
|
||||
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;
|
||||
|
||||
Reference in new issue
Block a user