Skip to content

Fix Clippy empty assertion lint - #55

Merged
JohanLorenzo merged 1 commit into
mozilla:mainfrom
JohanLorenzo:fix/clippy-assert-is-empty
Oct 2, 2026
Merged

JohanLorenzo merged 1 commit into
mozilla:mainfrom
JohanLorenzo:fix/clippy-assert-is-empty

Conversation

@JohanLorenzo

@JohanLorenzo JohanLorenzo commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Replace four empty-value assertions with equality assertions so Clippy 1.99.0 passes with pedantic warnings denied. Found in https://github.com/mozilla/stmo-cli/actions/runs/36969585007/job/110720550646?pr=54:

error: used `assert!` to check that a value is empty
   --> src/commands/dashboards.rs:565:9
    |
565 |         assert!(slugs.is_empty());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#assert_is_empty
    = note: `-D clippy::assert-is-empty` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(clippy::assert_is_empty)]`
help: use `assert_eq!` to show the value on failure
    |
565 -         assert!(slugs.is_empty());
565 +         assert_eq!(slugs, [] as [std::string::String; 0]);
    |

error: used `assert!` to check that a value is empty
   --> src/commands/snippets.rs:449:9
    |
449 |         assert!(result.unwrap().is_empty());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#assert_is_empty
help: use `assert_eq!` to show the value on failure
    |
449 -         assert!(result.unwrap().is_empty());
449 +         assert_eq!(result.unwrap(), [] as [u64; 0]);
    |

error: used `assert!` to check that a value is empty
   --> src/commands/snippets.rs:458:9
    |
458 |         assert!(result.unwrap().is_empty());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#assert_is_empty
help: use `assert_eq!` to show the value on failure
    |
458 -         assert!(result.unwrap().is_empty());
458 +         assert_eq!(result.unwrap(), [] as [u64; 0]);
    |

error: used `assert!` to check that a value is empty
   --> src/commands/snippets.rs:678:9
    |
678 |         assert!(metadata.is_empty());
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.99.0/index.html#assert_is_empty
help: use `assert_eq!` to show the value on failure
    |
678 -         assert!(metadata.is_empty());
678 +         assert_eq!(metadata, [] as [(u64, std::string::String); 0]);
    |

error: could not compile `stmo-cli` (lib test) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `stmo-cli` (bin "stmo-cli" test) due to 4 previous errors
Error: Process completed with exit code 101.

@JohanLorenzo
JohanLorenzo merged commit 7a60c35 into mozilla:main Oct 2, 2026
6 checks passed
@JohanLorenzo
JohanLorenzo deleted the fix/clippy-assert-is-empty branch October 2, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant