From 8e83afa61f0e463da6705b384fe3998edd2b7c6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 30 Mar 2020 20:01:57 +0200 Subject: [PATCH] don't emit lifetime lints for code inside macros. Fixes #5283 --- clippy_lints/src/lifetimes.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index 8a23bedfdbea9..d80ad47ab2468 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -9,15 +9,14 @@ use rustc_hir::{ ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitFn, TraitItem, TraitItemKind, Ty, TyKind, WhereClause, WherePredicate, }; -use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_lint::{LateContext, LateLintPass}; use rustc_middle::hir::map::Map; -use rustc_middle::lint::in_external_macro; use rustc_session::{declare_lint_pass, declare_tool_lint}; use rustc_span::source_map::Span; use rustc_span::symbol::kw; use crate::reexport::Name; -use crate::utils::{last_path_segment, span_lint, trait_ref_of_method}; +use crate::utils::{in_macro, last_path_segment, span_lint, trait_ref_of_method}; declare_clippy_lint! { /// **What it does:** Checks for lifetime annotations which can be removed by @@ -125,7 +124,7 @@ fn check_fn_inner<'a, 'tcx>( span: Span, report_extra_lifetimes: bool, ) { - if in_external_macro(cx.sess(), span) || has_where_lifetimes(cx, &generics.where_clause) { + if in_macro(span) || has_where_lifetimes(cx, &generics.where_clause) { return; }