rust-clippy/tests/ui/assertions_on_constants.stderr
bors 786f874c34 New macro utils
changelog: none

Sorry, this is a big one. A lot of interrelated changes and I wanted to put the new utils to use to make sure they are somewhat battle-tested. We may want to divide some of the lint-specific refactoring commits into batches for smaller reviewing tasks. I could also split into more PRs.

Introduces a bunch of new utils at `clippy_utils::macros::...`. Please read through the docs and give any feedback! I'm happy to introduce `MacroCall` and various functions to retrieve an instance. It feels like the missing puzzle piece. I'm also introducing `ExpnId` from rustc as "useful for Clippy too". `@rust-lang/clippy`

Fixes #7843 by not parsing every node of macro implementations, at least the major offenders.

I probably want to get rid of `is_expn_of` at some point.
2022-01-04 22:32:02 +00:00

75 lines
2 KiB
Text

error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:10:5
|
LL | assert!(true);
| ^^^^^^^^^^^^^
|
= note: `-D clippy::assertions-on-constants` implied by `-D warnings`
= help: remove it
error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:11:5
|
LL | assert!(false);
| ^^^^^^^^^^^^^^
|
= help: use `panic!()` or `unreachable!()`
error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:12:5
|
LL | assert!(true, "true message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: remove it
error: `assert!(false, ..)` should probably be replaced
--> $DIR/assertions_on_constants.rs:13:5
|
LL | assert!(false, "false message");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!(..)` or `unreachable!(..)`
error: `assert!(false, ..)` should probably be replaced
--> $DIR/assertions_on_constants.rs:16:5
|
LL | assert!(false, "{}", msg.to_uppercase());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!(..)` or `unreachable!(..)`
error: `assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:19:5
|
LL | assert!(B);
| ^^^^^^^^^^
|
= help: remove it
error: `assert!(false)` should probably be replaced
--> $DIR/assertions_on_constants.rs:22:5
|
LL | assert!(C);
| ^^^^^^^^^^
|
= help: use `panic!()` or `unreachable!()`
error: `assert!(false, ..)` should probably be replaced
--> $DIR/assertions_on_constants.rs:23:5
|
LL | assert!(C, "C message");
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: use `panic!(..)` or `unreachable!(..)`
error: `debug_assert!(true)` will be optimized out by the compiler
--> $DIR/assertions_on_constants.rs:25:5
|
LL | debug_assert!(true);
| ^^^^^^^^^^^^^^^^^^^
|
= help: remove it
error: aborting due to 9 previous errors