Skip to content

Commit 47e4c95

Browse files
committed
Fix author lint and move it back to tests/ui
The author lint is not an internal lint, but a lint that should be eval_always and also be enabled, when Clippy is distributed through rustup. This adds a dummy lint clippy::AUTHOR that is eval_always, but not shown in the Clippy documentation. Similar to the clippy::CTFE lint.
1 parent 21dd32e commit 47e4c95

23 files changed

+13
-5
lines changed

clippy_lints/src/utils/author.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ use rustc_hir::{
77
ExprKind, FnRetTy, HirId, Lit, PatKind, QPath, StmtKind, TyKind,
88
};
99
use rustc_lint::{LateContext, LateLintPass, LintContext};
10-
use rustc_session::declare_lint_pass;
10+
use rustc_session::{declare_lint_pass, declare_tool_lint};
1111
use rustc_span::symbol::{Ident, Symbol};
1212
use std::cell::Cell;
1313
use std::fmt::{Display, Formatter, Write as _};
1414

15-
declare_lint_pass!(
15+
// Not using `declare_clippy_lint`, so that no static CLIPPY_CTFE_INFO is created, so this lint
16+
// doesn't show up in the documentation.
17+
declare_tool_lint! {
1618
/// ### What it does
1719
/// Generates clippy code that detects the offending pattern
1820
///
@@ -44,7 +46,15 @@ declare_lint_pass!(
4446
/// // report your lint here
4547
/// }
4648
/// ```
47-
Author => []
49+
pub clippy::AUTHOR,
50+
Allow,
51+
"Ensure CTFE is being made",
52+
report_in_external_macro: true,
53+
@eval_always = true
54+
}
55+
56+
declare_lint_pass!(
57+
Author => [AUTHOR]
4858
);
4959

5060
/// Writes a line of output with indentation added

tests/ui-internal/author.rs renamed to tests/ui/author.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![warn(clippy::author)]
2-
31
fn main() {
42
#[clippy::author]
53
let x: char = 0x45 as char;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)