This lint shows up even when I add as message as a second parameter to the assert! macro.
Lint Name
missing-assert-message
Reproducer
I tried this code:
pub struct Service {
ready: bool,
}
pub fn call(service: Service) {
assert!(service.ready, "`service.poll_ready()` must be called first to ensure that service is ready to receive requests");
}
I saw this happen:
C:\Users\sandersd\Exercism\rust\poker\src>cargo clippy -- -Dclippy::missing_assert_message
Checking poker v1.1.0 (C:\Users\sandersd\Exercism\rust\poker)
error: assert without any message
--> src\lib.rs:6:5
|
6 | assert!(service.ready, "`service.poll_ready()` must be called first to ensure that service is ready to receive requests...
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: consider describing why the failing assert is problematic
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_assert_message
= note: requested on the command line with `-D clippy::missing-assert-message`
error: could not compile `poker` (lib) due to 1 previous error```
I expected to see this happen:
C:\Users\sandersd\Exercism\rust\poker\src>cargo clippy -- -Dclippy::missing_assert_message
Checking poker v1.1.0 (C:\Users\sandersd\Exercism\rust\poker)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.50s
### Version
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: x86_64-pc-windows-msvc
release: 1.81.0
LLVM version: 18.1.7
### Additional Labels
_No response_
Summary
This lint shows up even when I add as message as a second parameter to the assert! macro.
Lint Name
missing-assert-message
Reproducer
I tried this code:
I saw this happen: