Skip to content

Commit e6b9206

Browse files
committed
Rename CLIPPY_CTFE->CTFE and use declare_tool_lint to declare it
1 parent 47e4c95 commit e6b9206

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

clippy_lints/src/ctfe.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,25 @@
1+
#![cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
2+
13
use rustc_hir::def_id::LocalDefId;
24
use rustc_hir::intravisit::FnKind;
35
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};
78
use rustc_span::Span;
89

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",
1618
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+
}
2521

26-
declare_lint_pass! { ClippyCtfe => [CLIPPY_CTFE] }
22+
declare_lint_pass! { ClippyCtfe => [CTFE] }
2723

2824
impl<'tcx> LateLintPass<'tcx> for ClippyCtfe {
2925
fn check_fn(

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ mod declare_clippy_lint;
6262
#[macro_use]
6363
extern crate clippy_utils;
6464

65-
#[cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
6665
mod utils;
6766

68-
pub mod ctfe; // Very important lint, do not remove (rust#125116)
6967
pub mod declared_lints;
7068
pub mod deprecated_lints;
7169

70+
mod ctfe; // Very important lint, do not remove (rust#125116)
71+
7272
// begin lints modules, do not remove this comment, it’s used in `update_lints`
7373
mod absolute_paths;
7474
mod almost_complete_range;

clippy_lints/src/utils/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![cfg_attr(feature = "internal", allow(clippy::missing_clippy_version_attribute))]
2+
13
pub mod author;
24
pub mod dump_hir;
35
pub mod format_args_collector;

0 commit comments

Comments
 (0)