Skip to content

DesignCraft: An open-source page and layout design editor written by scratch in pure Rust

Satisfy clippy's nonminimal_bool on rustc 1.96

skylar taylor-barrickbc840130a4e0
diff --git a/crates/engine/src/tests_file_guard.rs b/crates/engine/src/tests_file_guard.rs
index 21c8f301d..9f2af3c32 100644
--- a/crates/engine/src/tests_file_guard.rs
+++ b/crates/engine/src/tests_file_guard.rs
@@ -158,7 +158,7 @@ fn offenders(crates_dir: &Path) -> (Vec<String>, usize) {
for path in files {
let rel = path.strip_prefix(crates_dir).unwrap_or(&path).to_string_lossy().replace('\\', "/");
// `crates/<name>/src/...` only: build scripts, benches and `tests/` are not shipped code.
- if !rel.split('/').nth(1).is_some_and(|d| d == "src") || is_test_file(&rel) || ALLOWED.iter().any(|(allowed, _)| *allowed == rel) {
+ if rel.split('/').nth(1).is_none_or(|d| d != "src") || is_test_file(&rel) || ALLOWED.iter().any(|(allowed, _)| *allowed == rel) {
continue;
}
let Ok(text) = std::fs::read_to_string(&path) else { continue };
diff --git a/crates/render/src/pdf_bounds.rs b/crates/render/src/pdf_bounds.rs
index 47a021529..74665ae3c 100644
--- a/crates/render/src/pdf_bounds.rs
+++ b/crates/render/src/pdf_bounds.rs
@@ -48,7 +48,7 @@ impl Bounds {
}
let Some(clip) = self.clips.last() else { return };
let r = r.intersect(*clip);
- if !(r.width() > 0.0 && r.height() > 0.0) || ![r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) {
+ if !(r.width() > 0.0 && r.height() > 0.0 && [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite())) {
return;
}
self.out = Some(self.out.map_or(r, |o| o.union(r)));
diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs
index 79eb2c44c..fcb764c5a 100644
--- a/crates/ui-egui/src/lib.rs
+++ b/crates/ui-egui/src/lib.rs
@@ -950,7 +950,7 @@ impl DesignApp {
}
}
// Release only when the request actually replaces Find, including a native PDF picker.
- if was_find && !self.ui.dialog.as_ref().is_some_and(|d| d.id == "findChange") {
+ if was_find && self.ui.dialog.as_ref().is_none_or(|d| d.id != "findChange") {
self.session.reset_find_scope();
}
}
@@ -1437,7 +1437,7 @@ impl DesignApp {
self.status(format!("{file}: {}", warnings.join("; ")));
// Find Font, offered for the document's missing fonts, stays up: the status line
// keeps the warnings.
- if !self.ui.dialog.as_ref().is_some_and(|d| d.id == "findFont") {
+ if self.ui.dialog.as_ref().is_none_or(|d| d.id != "findFont") {
self.ui.dialog =
Some(dialogs::Dialog::new("alert", json!({"title": "Import Warnings", "file": file, "message": warnings.join("\n")})));
}