Skip to content

Commit 05bfcbd

Browse files
committed
remove tuple
1 parent 497f377 commit 05bfcbd

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

clippy_lints/src/allow_attributes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use ast::AttrStyle;
1+
use ast::{AttrStyle, Attribute};
22
use clippy_utils::{diagnostics::span_lint_and_sugg, is_from_proc_macro};
33
use rustc_ast as ast;
44
use rustc_errors::Applicability;
@@ -50,14 +50,14 @@ declare_lint_pass!(AllowAttribute => [ALLOW_ATTRIBUTES]);
5050

5151
impl LateLintPass<'_> for AllowAttribute {
5252
// Separate each crate's features.
53-
fn check_attribute(&mut self, cx: &LateContext<'_>, attr: &ast::Attribute) {
53+
fn check_attribute<'cx>(&mut self, cx: &LateContext<'cx>, attr: &'cx Attribute) {
5454
if_chain! {
5555
if !in_external_macro(cx.sess(), attr.span);
5656
if cx.tcx.features().lint_reasons;
5757
if let AttrStyle::Outer = attr.style;
5858
if let Some(ident) = attr.ident();
5959
if ident.name == rustc_span::symbol::sym::allow;
60-
if !is_from_proc_macro(cx, &(attr, cx));
60+
if !is_from_proc_macro(cx, &attr);
6161
then {
6262
span_lint_and_sugg(
6363
cx,

clippy_lints/src/attrs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_>, name: Symbol, items: &[NestedMe
543543
}
544544
}
545545

546-
fn check_lint_reason(cx: &LateContext<'_>, name: Symbol, items: &[NestedMetaItem], attr: &Attribute) {
546+
fn check_lint_reason<'cx>(cx: &LateContext<'cx>, name: Symbol, items: &[NestedMetaItem], attr: &'cx Attribute) {
547547
// Check for the feature
548548
if !cx.tcx.features().lint_reasons {
549549
return;
@@ -558,7 +558,7 @@ fn check_lint_reason(cx: &LateContext<'_>, name: Symbol, items: &[NestedMetaItem
558558
}
559559

560560
// Check if the attribute is in an external macro and therefore out of the developer's control
561-
if in_external_macro(cx.sess(), attr.span) || is_from_proc_macro(cx, &(attr, cx)) {
561+
if in_external_macro(cx.sess(), attr.span) || is_from_proc_macro(cx, &attr) {
562562
return;
563563
}
564564

clippy_utils/src/check_proc_macro.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,16 @@ impl<'cx> WithSearchPat for (&FnKind<'cx>, &Body<'cx>, HirId, Span) {
358358
}
359359
}
360360

361-
impl<'cx> WithSearchPat for (&Attribute, &LateContext<'cx>) {
361+
// `Attribute` does not have the `hir` associated lifetime, so we cannot use the macro
362+
impl<'cx> WithSearchPat for &'cx Attribute {
362363
type Context = LateContext<'cx>;
363364

364365
fn search_pat(&self, _cx: &Self::Context) -> (Pat, Pat) {
365-
attr_search_pat(self.0)
366+
attr_search_pat(self)
366367
}
367368

368369
fn span(&self) -> Span {
369-
self.0.span
370+
self.span
370371
}
371372
}
372373

0 commit comments

Comments
 (0)