mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-22 02:53:20 +00:00
786f874c34
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.
106 lines
2.9 KiB
Text
106 lines
2.9 KiB
Text
error: `panic` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:8:5
|
|
|
|
|
LL | panic!();
|
|
| ^^^^^^^^
|
|
|
|
|
= note: `-D clippy::panic` implied by `-D warnings`
|
|
|
|
error: `panic` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:9:5
|
|
|
|
|
LL | panic!("message");
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
error: `panic` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:10:5
|
|
|
|
|
LL | panic!("{} {}", "panic with", "multiple arguments");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `todo` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:16:5
|
|
|
|
|
LL | todo!();
|
|
| ^^^^^^^
|
|
|
|
|
= note: `-D clippy::todo` implied by `-D warnings`
|
|
|
|
error: `todo` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:17:5
|
|
|
|
|
LL | todo!("message");
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: `todo` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:18:5
|
|
|
|
|
LL | todo!("{} {}", "panic with", "multiple arguments");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `unimplemented` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:24:5
|
|
|
|
|
LL | unimplemented!();
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::unimplemented` implied by `-D warnings`
|
|
|
|
error: `unimplemented` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:25:5
|
|
|
|
|
LL | unimplemented!("message");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `unimplemented` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:26:5
|
|
|
|
|
LL | unimplemented!("{} {}", "panic with", "multiple arguments");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: usage of the `unreachable!` macro
|
|
--> $DIR/panicking_macros.rs:32:5
|
|
|
|
|
LL | unreachable!();
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::unreachable` implied by `-D warnings`
|
|
|
|
error: usage of the `unreachable!` macro
|
|
--> $DIR/panicking_macros.rs:33:5
|
|
|
|
|
LL | unreachable!("message");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: usage of the `unreachable!` macro
|
|
--> $DIR/panicking_macros.rs:34:5
|
|
|
|
|
LL | unreachable!("{} {}", "panic with", "multiple arguments");
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: `panic` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:40:5
|
|
|
|
|
LL | panic!();
|
|
| ^^^^^^^^
|
|
|
|
error: `todo` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:41:5
|
|
|
|
|
LL | todo!();
|
|
| ^^^^^^^
|
|
|
|
error: `unimplemented` should not be present in production code
|
|
--> $DIR/panicking_macros.rs:42:5
|
|
|
|
|
LL | unimplemented!();
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error: usage of the `unreachable!` macro
|
|
--> $DIR/panicking_macros.rs:43:5
|
|
|
|
|
LL | unreachable!();
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 16 previous errors
|
|
|