From 88a1b56754190731a9042cded1f03790daf087a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Mon, 9 Mar 2020 18:57:08 +0100 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 a120e3a7517f..71270797fdec 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -1,6 +1,5 @@ use matches::matches; use rustc::hir::map::Map; -use rustc::lint::in_external_macro; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir::def::{DefKind, Res}; use rustc_hir::intravisit::{ @@ -12,13 +11,13 @@ use rustc_hir::{ ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitItem, TraitItemKind, TraitMethod, Ty, TyKind, WhereClause, WherePredicate, }; -use rustc_lint::{LateContext, LateLintPass, LintContext}; +use rustc_lint::{LateContext, LateLintPass}; 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 @@ -126,7 +125,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; }