Skip to content

Commit

Permalink
Add the new line to new_lint + fix dogfood
Browse files Browse the repository at this point in the history
  • Loading branch information
blyxyas committed Sep 7, 2024
1 parent 8500ecb commit a63f367
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 2 additions & 0 deletions clippy_dev/src/new_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
result.push_str(&if enable_msrv {
formatdoc!(
r#"
use crate::declare_clippy_lint;
use clippy_config::msrvs::{{self, Msrv}};
use clippy_config::Conf;
{pass_import}
Expand All @@ -284,6 +285,7 @@ fn get_lint_file_contents(lint: &LintData<'_>, enable_msrv: bool) -> String {
} else {
formatdoc!(
r#"
use crate::declare_clippy_lint;
{pass_import}
use rustc_lint::{{{context_import}, {pass_type}}};
use rustc_session::declare_lint_pass;
Expand Down
22 changes: 11 additions & 11 deletions clippy_lints/src/declare_clippy_lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ macro_rules! declare_clippy_lint {
report_in_external_macro:true
}

pub(crate) static ${concat($lint_name, _INFO)}: &'static crate::LintInfo = &crate::LintInfo {
pub(crate) static ${concat($lint_name, _INFO)}: &'static $crate::LintInfo = &$crate::LintInfo {
lint: &$lint_name,
category: $lintcategory,
explanation: concat!($($lit,"\n",)*),
Expand All @@ -36,7 +36,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Allow, crate::LintCategory::Restriction,$desc,
pub $lint_name,Allow, $crate::LintCategory::Restriction,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -49,7 +49,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name, Warn, crate::LintCategory::Style,$desc,
pub $lint_name, Warn, $crate::LintCategory::Style,$desc,
declare_clippy_lint!(__version = $version), $version

}
Expand All @@ -63,7 +63,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Deny, crate::LintCategory::Correctness,$desc,
pub $lint_name,Deny, $crate::LintCategory::Correctness,$desc,
declare_clippy_lint!(__version = $version), $version

}
Expand All @@ -77,7 +77,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name, Warn, crate::LintCategory::Perf,$desc,
pub $lint_name, Warn, $crate::LintCategory::Perf,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -90,7 +90,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name, Warn, crate::LintCategory::Complexity,$desc,
pub $lint_name, Warn, $crate::LintCategory::Complexity,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -103,7 +103,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name, Warn, crate::LintCategory::Suspicious,$desc,
pub $lint_name, Warn, $crate::LintCategory::Suspicious,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -116,7 +116,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Allow, crate::LintCategory::Nursery,$desc,
pub $lint_name,Allow, $crate::LintCategory::Nursery,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -129,7 +129,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Allow, crate::LintCategory::Pedantic,$desc,
pub $lint_name,Allow, $crate::LintCategory::Pedantic,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -142,7 +142,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Allow, crate::LintCategory::Cargo,$desc,
pub $lint_name,Allow, $crate::LintCategory::Cargo,$desc,
declare_clippy_lint!(__version = $version), $version
}
};
Expand All @@ -156,7 +156,7 @@ macro_rules! declare_clippy_lint {
) => {
declare_clippy_lint! {@
$(#[doc = $lit])*
pub $lint_name,Allow, crate::LintCategory::Internal,$desc,
pub $lint_name,Allow, $crate::LintCategory::Internal,$desc,
declare_clippy_lint!(__version = $($version)?), "0.0.0"
}
};
Expand Down
1 change: 0 additions & 1 deletion tests/versioncheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ fn consistent_clippy_crate_versions() {
let clippy_version = read_version("Cargo.toml");

let paths = [
"declare_clippy_lint/Cargo.toml",
"clippy_config/Cargo.toml",
"clippy_lints/Cargo.toml",
"clippy_utils/Cargo.toml",
Expand Down

0 comments on commit a63f367

Please sign in to comment.