mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-24 10:16:59 -06:00
Satisfy clippy's nonminimal_bool on rustc 1.96
Four sites already on main that `cargo xtask ci` cannot get past with the current toolchain; each rewrite is the one clippy suggests and changes no behaviour. `!x.is_some_and(f)` becomes `x.is_none_or(!f)`, and pdf_bounds folds `!(a && b) || !c` into `!(a && b && c)` by De Morgan. Unrelated to the merge they are committed beside; separated so that merge stays a merge.
This commit is contained in:
@@ -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 };
|
||||
|
||||
@@ -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)));
|
||||
|
||||
@@ -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")})));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user