mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-17 23:46:10 +00:00
* Clear the clippy 1.100 lints that fail the gate on main (#13531) Clippy 1.100.0 flags needless_range_loop in cms synth.rs (the gate failure on main), algo photo_util.rs and an engine multichannel test, and, on Windows only, needless_bool in format noreplace.rs, where the cfg(unix) branch compiles away. Each loop now iterates the slice it indexed, with the same values in the same order. * Clear the Linux-only clippy 1.100 needless_bool lints (#13531) paths_match in ui-egui and is_redirect in the app ended with a cfg(not(windows)) branch that is just `false`, which clippy 1.100 flags on Linux. Each platform's branch now returns the whole comparison: the same results, in the same order.
This commit is contained in:
1 parent
134208d7fd
commit
e660b4906b
6 files changed
+11
-22
No files matched your search
@@ -627,17 +627,14 @@ mod native {
|
||||
/// True for a symlink, or on Windows any reparse point, whose target could be swapped.
|
||||
/// Expects `symlink_metadata`, which describes the link itself rather than its target.
|
||||
fn is_redirect(metadata: &Metadata) -> bool {
|
||||
if metadata.file_type().is_symlink() {
|
||||
return true;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
use std::os::windows::fs::MetadataExt;
|
||||
metadata.file_attributes() & 0x0000_0400 != 0 // FILE_ATTRIBUTE_REPARSE_POINT
|
||||
metadata.file_type().is_symlink() || metadata.file_attributes() & 0x0000_0400 != 0 // FILE_ATTRIBUTE_REPARSE_POINT
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
false
|
||||
metadata.file_type().is_symlink()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -167,8 +167,8 @@ impl BandChol {
|
||||
let n = a.diag.len();
|
||||
let mut p = 0;
|
||||
for i in 0..n {
|
||||
for k in a.rows[i]..a.rows[i + 1] {
|
||||
p = p.max(i.abs_diff(a.cols[k]));
|
||||
for &j in &a.cols[a.rows[i]..a.rows[i + 1]] {
|
||||
p = p.max(i.abs_diff(j));
|
||||
}
|
||||
}
|
||||
if n.saturating_mul(p + 1) > 40_000_000 {
|
||||
|
||||
@@ -119,7 +119,7 @@ impl CmykModel {
|
||||
(v + 4.0 * self.tvi[i] * v * (1.0 - v)).clamp(0.0, 1.0)
|
||||
});
|
||||
let mut s = [0.0; 3];
|
||||
for m in 0..16 {
|
||||
for (m, prim) in self.prim_n.iter().enumerate() {
|
||||
let mut w = 1.0;
|
||||
for (i, ai) in a.iter().enumerate() {
|
||||
w *= if m & (1 << i) != 0 { *ai } else { 1.0 - ai };
|
||||
@@ -127,7 +127,7 @@ impl CmykModel {
|
||||
if w == 0.0 {
|
||||
continue;
|
||||
}
|
||||
for (acc, p) in s.iter_mut().zip(&self.prim_n[m]) {
|
||||
for (acc, p) in s.iter_mut().zip(prim) {
|
||||
*acc += w * p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ fn flattens_layers_and_keeps_alpha_channels() {
|
||||
assert_eq!(d.channels.len(), 4);
|
||||
assert!(d.channels[3].spot.is_none(), "the saved selection stays an alpha channel");
|
||||
// The black fill on the upper layer is solid ink in all three plates.
|
||||
for k in 0..3 {
|
||||
assert!(d.channels[k].surface.pixel(1, 1)[0] > 0.99);
|
||||
for c in &d.channels[..3] {
|
||||
assert!(c.surface.pixel(1, 1)[0] > 0.99);
|
||||
}
|
||||
// Back to RGB: the alpha channel survives, the inks become colour channels.
|
||||
s.execute("image.mode.rgb", json!({})).unwrap();
|
||||
|
||||
@@ -107,14 +107,11 @@ pub fn rename_noreplace(from: &Path, to: &Path) -> io::Result<()> {
|
||||
|
||||
/// Use fallback only when the exclusive rename primitive itself is unsupported.
|
||||
fn unsupported_rename(error: &io::Error) -> bool {
|
||||
if error.kind() == io::ErrorKind::Unsupported {
|
||||
return true;
|
||||
}
|
||||
#[cfg(unix)]
|
||||
if matches!(error.raw_os_error(), Some(code) if code == rustix::io::Errno::INVAL.raw_os_error() || code == rustix::io::Errno::NOSYS.raw_os_error()) {
|
||||
return true;
|
||||
}
|
||||
false
|
||||
error.kind() == io::ErrorKind::Unsupported
|
||||
}
|
||||
|
||||
/// Linking claims an absent destination atomically; a later unlink failure is already published.
|
||||
|
||||
@@ -82,18 +82,13 @@ impl ThumbnailCache {
|
||||
|
||||
/// Check if two path strings match, tolerating slash direction and Windows case differences.
|
||||
fn paths_match(a: &str, b: &str) -> bool {
|
||||
if a == b {
|
||||
return true;
|
||||
}
|
||||
#[cfg(windows)]
|
||||
{
|
||||
let a_norm = a.replace('\\', "/");
|
||||
let b_norm = b.replace('\\', "/");
|
||||
a_norm.eq_ignore_ascii_case(&b_norm)
|
||||
a == b || a.replace('\\', "/").eq_ignore_ascii_case(&b.replace('\\', "/"))
|
||||
}
|
||||
#[cfg(not(windows))]
|
||||
{
|
||||
false
|
||||
a == b
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user