fix false positive

This commit is contained in:
Centri3 2023-04-21 05:12:14 -05:00
parent c976ad07ee
commit 85d7de25a9
2 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,8 @@
use clippy_utils::diagnostics::span_lint_and_sugg;
use rustc_ast as ast;
use rustc_errors::Applicability;
use rustc_lint::{LateContext, LateLintPass};
use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};
declare_clippy_lint! {
@ -51,6 +52,7 @@ impl LateLintPass<'_> for AllowAttribute {
// Separate each crate's features.
fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
if_chain! {
if !in_external_macro(cx.sess(), attr.span);
if cx.tcx.features().lint_reasons;
if let AttrStyle::Outer = attr.style;
if let Some(ident) = attr.ident();

View File

@ -0,0 +1,6 @@
#![allow(unused)]
#![warn(clippy::allow_attributes)]
#![feature(lint_reasons)]
#![crate_type = "proc-macro"]
fn main() {}