Do not run lints that cannot emit
Before this change, adding a lint was a difficult matter because it always had some overhead involved. This was because all lints would run, no matter their default level, or if the user had #![allow]ed them. This PR changes that
This commit is contained in:
parent
91a458f451
commit
698363122e
@ -3,7 +3,7 @@
|
|||||||
use clippy_utils::diagnostics::span_lint_and_then;
|
use clippy_utils::diagnostics::span_lint_and_then;
|
||||||
use rustc_ast::ast::{Expr, ExprKind, InlineAsmOptions};
|
use rustc_ast::ast::{Expr, ExprKind, InlineAsmOptions};
|
||||||
use rustc_ast::{InlineAsm, Item, ItemKind};
|
use rustc_ast::{InlineAsm, Item, ItemKind};
|
||||||
use rustc_lint::{EarlyContext, EarlyLintPass, Lint, LintContext};
|
use rustc_lint::{EarlyContext, EarlyLintPass, Lint, LintPass, LintContext};
|
||||||
use rustc_session::declare_lint_pass;
|
use rustc_session::declare_lint_pass;
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::asm::InlineAsmArch;
|
use rustc_target::asm::InlineAsmArch;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::fmt::{Display, Formatter, Write as _};
|
use std::fmt::{Display, Formatter, Write as _};
|
||||||
|
|
||||||
declare_lint_pass!(
|
declare_clippy_lint!{
|
||||||
/// ### What it does
|
/// ### What it does
|
||||||
/// Generates clippy code that detects the offending pattern
|
/// Generates clippy code that detects the offending pattern
|
||||||
///
|
///
|
||||||
@ -44,8 +44,13 @@
|
|||||||
/// // report your lint here
|
/// // report your lint here
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
Author => []
|
#[clippy::version = "1.0.0"]
|
||||||
);
|
pub AUTHOR,
|
||||||
|
internal,
|
||||||
|
"The author lint, see documentation at <https://doc.rust-lang.org/nightly/clippy/development/adding_lints.html#author-lint>"
|
||||||
|
};
|
||||||
|
|
||||||
|
declare_lint_pass! { Author => [AUTHOR] }
|
||||||
|
|
||||||
/// Writes a line of output with indentation added
|
/// Writes a line of output with indentation added
|
||||||
macro_rules! out {
|
macro_rules! out {
|
@ -1,4 +1,3 @@
|
|||||||
pub mod author;
|
|
||||||
pub mod dump_hir;
|
pub mod dump_hir;
|
||||||
pub mod format_args_collector;
|
pub mod format_args_collector;
|
||||||
#[cfg(feature = "internal")]
|
#[cfg(feature = "internal")]
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![warn(clippy::author)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[clippy::author]
|
#[clippy::author]
|
||||||
let x: char = 0x45 as char;
|
let x: char = 0x45 as char;
|
3
tests/ui/no_lints.rs
Normal file
3
tests/ui/no_lints.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
#![deny(clippy::all)]
|
||||||
|
|
||||||
|
fn main() {}
|
Loading…
Reference in New Issue
Block a user