Skip to main content

Lint clippy::nonminimal_bool

warning clippy::nonminimal_bool §

this boolean expression can be simplified

src/render/assets.rs:193:16

Clippy · Category: pedantic · cargo-clippy-html

Official Clippy documentation

Targets (1)
  • cargo-clippy-html (bin)

Primary: src/render/assets.rs:193:16

            || !target.extension().is_some_and(|ext| ext == "woff2")

help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#nonminimal_bool

note: `-W clippy::nonminimal-bool` implied by `-W clippy::pedantic`

help: to override `-W clippy::pedantic` add `#[allow(clippy::nonminimal_bool)]`

help: try

Suggestion: try

MachineApplicable

--- "a/src/render/assets.rs"
+++ "b/src/render/assets.rs"
@@ -190,7 +190,7 @@
             .map_err(|e| format!("Missing font resource {value}: {e}"))?;
         if !target.starts_with(root)
             || !target.is_file()
-            || !target.extension().is_some_and(|ext| ext == "woff2")
+            || target.extension().is_none_or(|ext| ext != "woff2")
         {
             return Err(format!("Invalid font resource: {value}"));
         }
Rendered diagnostic (text)
warning: this boolean expression can be simplified
   --> src/render/assets.rs:193:16
    |
193 |             || !target.extension().is_some_and(|ext| ext == "woff2")
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `target.extension().is_none_or(|ext| ext != "woff2")`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.100.0/index.html#nonminimal_bool
    = note: `-W clippy::nonminimal-bool` implied by `-W clippy::pedantic`
    = help: to override `-W clippy::pedantic` add `#[allow(clippy::nonminimal_bool)]`