|
| 1 | +#![cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))] |
| 2 | + |
1 | 3 | use rustc_hir::def_id::LocalDefId;
|
2 | 4 | use rustc_hir::intravisit::FnKind;
|
3 | 5 | use rustc_hir::{Body, FnDecl};
|
4 |
| -use rustc_lint::Level::Deny; |
5 |
| -use rustc_lint::{LateContext, LateLintPass, Lint}; |
6 |
| -use rustc_session::declare_lint_pass; |
| 6 | +use rustc_lint::{LateContext, LateLintPass}; |
| 7 | +use rustc_session::{declare_lint_pass, declare_tool_lint}; |
7 | 8 | use rustc_span::Span;
|
8 | 9 |
|
9 |
| -/// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes). |
10 |
| -/// As Clippy deactivates codegen, this lint ensures that CTFE (used in hard errors) is still ran. |
11 |
| -pub static CLIPPY_CTFE: &Lint = &Lint { |
12 |
| - name: &"clippy::CLIPPY_CTFE", |
13 |
| - default_level: Deny, |
14 |
| - desc: "Ensure CTFE is being made", |
15 |
| - edition_lint_opts: None, |
| 10 | +// Not using `declare_clippy_lint`, so that no static CLIPPY_CTFE_INFO is created, so this lint |
| 11 | +// doesn't show up in the documentation. |
| 12 | +declare_tool_lint! { |
| 13 | + /// Ensures that Constant-time Function Evaluation is being done (specifically, MIR lint passes). |
| 14 | + /// As Clippy deactivates codegen, this lint ensures that CTFE (used in hard errors) is still ran. |
| 15 | + pub clippy::CTFE, |
| 16 | + Allow, |
| 17 | + "Ensure CTFE is being made", |
16 | 18 | report_in_external_macro: true,
|
17 |
| - future_incompatible: None, |
18 |
| - is_externally_loaded: true, |
19 |
| - crate_level_only: false, |
20 |
| - eval_always: true, |
21 |
| - ..Lint::default_fields_for_macro() |
22 |
| -}; |
23 |
| - |
24 |
| -// No static CLIPPY_CTFE_INFO because we want this lint to be invisible |
| 19 | + @eval_always = true |
| 20 | +} |
25 | 21 |
|
26 |
| -declare_lint_pass! { ClippyCtfe => [CLIPPY_CTFE] } |
| 22 | +declare_lint_pass! { ClippyCtfe => [CTFE] } |
27 | 23 |
|
28 | 24 | impl<'tcx> LateLintPass<'tcx> for ClippyCtfe {
|
29 | 25 | fn check_fn(
|
|
0 commit comments