diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/assertions_on_constants.rs')
| -rw-r--r-- | src/tools/clippy/tests/ui/assertions_on_constants.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/assertions_on_constants.rs b/src/tools/clippy/tests/ui/assertions_on_constants.rs index 7bea9563d47..10809a6d247 100644 --- a/src/tools/clippy/tests/ui/assertions_on_constants.rs +++ b/src/tools/clippy/tests/ui/assertions_on_constants.rs @@ -8,21 +8,30 @@ macro_rules! assert_const { } fn main() { assert!(true); + //~^ ERROR: `assert!(true)` will be optimized out by the compiler assert!(false); + //~^ ERROR: `assert!(false)` should probably be replaced assert!(true, "true message"); + //~^ ERROR: `assert!(true)` will be optimized out by the compiler assert!(false, "false message"); + //~^ ERROR: `assert!(false, ..)` should probably be replaced let msg = "panic message"; assert!(false, "{}", msg.to_uppercase()); + //~^ ERROR: `assert!(false, ..)` should probably be replaced const B: bool = true; assert!(B); + //~^ ERROR: `assert!(true)` will be optimized out by the compiler const C: bool = false; assert!(C); + //~^ ERROR: `assert!(false)` should probably be replaced assert!(C, "C message"); + //~^ ERROR: `assert!(false, ..)` should probably be replaced debug_assert!(true); + //~^ ERROR: `debug_assert!(true)` will be optimized out by the compiler // Don't lint this, since there is no better way for expressing "Only panic in debug mode". debug_assert!(false); // #3948 assert_const!(3); |
