diff options
Diffstat (limited to 'src/tools/clippy/src/docs/disallowed_macros.txt')
-rw-r--r-- | src/tools/clippy/src/docs/disallowed_macros.txt | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/disallowed_macros.txt b/src/tools/clippy/src/docs/disallowed_macros.txt new file mode 100644 index 000000000..96fa15afa --- /dev/null +++ b/src/tools/clippy/src/docs/disallowed_macros.txt @@ -0,0 +1,36 @@ +### What it does +Denies the configured macros in clippy.toml + +Note: Even though this lint is warn-by-default, it will only trigger if +macros are defined in the clippy.toml file. + +### Why is this bad? +Some macros are undesirable in certain contexts, and it's beneficial to +lint for them as needed. + +### Example +An example clippy.toml configuration: +``` +disallowed-macros = [ + # Can use a string as the path of the disallowed macro. + "std::print", + # Can also use an inline table with a `path` key. + { path = "std::println" }, + # When using an inline table, can add a `reason` for why the macro + # is disallowed. + { path = "serde::Serialize", reason = "no serializing" }, +] +``` +``` +use serde::Serialize; + +// Example code where clippy issues a warning +println!("warns"); + +// The diagnostic will contain the message "no serializing" +#[derive(Serialize)] +struct Data { + name: String, + value: usize, +} +```
\ No newline at end of file |