Skip to content

Commit 85d7de2

Browse files
committed
fix false positive
1 parent c976ad0 commit 85d7de2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clippy_lints/src/allow_attributes.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ use ast::AttrStyle;
22
use clippy_utils::diagnostics::span_lint_and_sugg;
33
use rustc_ast as ast;
44
use rustc_errors::Applicability;
5-
use rustc_lint::{LateContext, LateLintPass};
5+
use rustc_lint::{LateContext, LateLintPass, LintContext};
6+
use rustc_middle::lint::in_external_macro;
67
use rustc_session::{declare_lint_pass, declare_tool_lint};
78

89
declare_clippy_lint! {
@@ -51,6 +52,7 @@ impl LateLintPass<'_> for AllowAttribute {
5152
// Separate each crate's features.
5253
fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
5354
if_chain! {
55+
if !in_external_macro(cx.sess(), attr.span);
5456
if cx.tcx.features().lint_reasons;
5557
if let AttrStyle::Outer = attr.style;
5658
if let Some(ident) = attr.ident();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![allow(unused)]
2+
#![warn(clippy::allow_attributes)]
3+
#![feature(lint_reasons)]
4+
#![crate_type = "proc-macro"]
5+
6+
fn main() {}

0 commit comments

Comments
 (0)