diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2022-04-02 16:57:09 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2022-04-03 08:54:37 -0400 |
| commit | 422741151359b8ad4b4f1f4a545aef27f5722c82 (patch) | |
| tree | 62722b2155e6e726ec9fe5102cc489c221fa7881 /clippy_dev | |
| parent | 85b88be2a4fc46fc27d51d4fb273d65818ee63d7 (diff) | |
Generate deprecated lints test
Diffstat (limited to 'clippy_dev')
| -rw-r--r-- | clippy_dev/src/update_lints.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index 4e48b670457..b010149626c 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -107,6 +107,9 @@ pub fn run(update_mode: UpdateMode) { &content, ); } + + let content = gen_deprecated_lints_test(&deprecated_lints); + process_file("tests/ui/deprecated.rs", update_mode, &content); } pub fn print_lints() { @@ -276,6 +279,15 @@ fn gen_register_lint_list<'a>( output } +fn gen_deprecated_lints_test(lints: &[DeprecatedLint]) -> String { + let mut res: String = GENERATED_FILE_COMMENT.into(); + for lint in lints { + writeln!(res, "#![warn(clippy::{})]", lint.name).unwrap(); + } + res.push_str("\nfn main() {}\n"); + res +} + /// Gathers all lints defined in `clippy_lints/src` fn gather_all() -> (Vec<Lint>, Vec<DeprecatedLint>) { let mut lints = Vec::with_capacity(1000); |
