about summary refs log tree commit diff
path: root/clippy_lints/src/lib.register_internal.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-10-23 22:18:04 +0000
committerbors <bors@rust-lang.org>2022-10-23 22:18:04 +0000
commit5b09d4e1f7082aff024faf27263f78e7fc7190a2 (patch)
tree782371e9ebdc91ab07d606175e4fa5e5517220b4 /clippy_lints/src/lib.register_internal.rs
parent191c9839f0bad1c2bfec17d55bacb94d2e83f1a1 (diff)
parent81345669887b53c63d0d6a50721e640197d90c66 (diff)
Auto merge of #9541 - Alexendoo:declare-proc-macro, r=flip1995
Generate lint categories and explanations with `declare_clippy_lint`

This means contributors will no longer have to run `cargo dev update_lints` after changing a lints documentation or its category, which may also mean fewer merge conflicts in general

It works by swapping `declare_clippy_lint` out for a `proc_macro` of the same name. The proc macro emits a `LintInfo` alongside the generated `Lint` which are gathered into `declared_lint::LINTS`. The categories/explanations are then read from `declared_lint::LINTS` at runtime

The removal of `src/docs` is split into a separate commit to be more easily ignored

It is slightly slower though, adding a bit under a second to build time. Less noticeable in full builds or with a slower linker (benchmark uses mold)

```bash
hyperfine --warmup 2 \
    --parameter-list commit "declare-proc-macro,master" \
    --command-name "{commit}" \
    --setup "git checkout {commit}" \
    --prepare "touch clippy_lints/src/lib.rs" \
    "cargo build"
```
```
Benchmark 1: declare-proc-macro
  Time (mean ± σ):     10.731 s ±  0.154 s    [User: 7.739 s, System: 1.791 s]
  Range (min … max):   10.598 s … 11.125 s    10 runs

Benchmark 2: master
  Time (mean ± σ):      9.422 s ±  0.094 s    [User: 7.183 s, System: 1.732 s]
  Range (min … max):    9.287 s …  9.624 s    10 runs

Summary
  'master' ran
    1.14 ± 0.02 times faster than 'declare-proc-macro'
```

r? `@flip1995`
cc `@llogiq` for `--explain`

changelog: none
Diffstat (limited to 'clippy_lints/src/lib.register_internal.rs')
-rw-r--r--clippy_lints/src/lib.register_internal.rs22
1 files changed, 0 insertions, 22 deletions
diff --git a/clippy_lints/src/lib.register_internal.rs b/clippy_lints/src/lib.register_internal.rs
deleted file mode 100644
index 40c94c6e8d3..00000000000
--- a/clippy_lints/src/lib.register_internal.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// This file was generated by `cargo dev update_lints`.
-// Use that command to update this file and do not edit by hand.
-// Manual edits will be overwritten.
-
-store.register_group(true, "clippy::internal", Some("clippy_internal"), vec![
-    LintId::of(utils::internal_lints::clippy_lints_internal::CLIPPY_LINTS_INTERNAL),
-    LintId::of(utils::internal_lints::collapsible_calls::COLLAPSIBLE_SPAN_LINT_CALLS),
-    LintId::of(utils::internal_lints::compiler_lint_functions::COMPILER_LINT_FUNCTIONS),
-    LintId::of(utils::internal_lints::if_chain_style::IF_CHAIN_STYLE),
-    LintId::of(utils::internal_lints::interning_defined_symbol::INTERNING_DEFINED_SYMBOL),
-    LintId::of(utils::internal_lints::interning_defined_symbol::UNNECESSARY_SYMBOL_STR),
-    LintId::of(utils::internal_lints::invalid_paths::INVALID_PATHS),
-    LintId::of(utils::internal_lints::lint_without_lint_pass::DEFAULT_DEPRECATION_REASON),
-    LintId::of(utils::internal_lints::lint_without_lint_pass::DEFAULT_LINT),
-    LintId::of(utils::internal_lints::lint_without_lint_pass::INVALID_CLIPPY_VERSION_ATTRIBUTE),
-    LintId::of(utils::internal_lints::lint_without_lint_pass::LINT_WITHOUT_LINT_PASS),
-    LintId::of(utils::internal_lints::lint_without_lint_pass::MISSING_CLIPPY_VERSION_ATTRIBUTE),
-    LintId::of(utils::internal_lints::msrv_attr_impl::MISSING_MSRV_ATTR_IMPL),
-    LintId::of(utils::internal_lints::outer_expn_data_pass::OUTER_EXPN_EXPN_DATA),
-    LintId::of(utils::internal_lints::produce_ice::PRODUCE_ICE),
-    LintId::of(utils::internal_lints::unnecessary_def_path::UNNECESSARY_DEF_PATH),
-])