Skip to content

Commit 88a1b56

Browse files
committed
don't emit lifetime lints for code inside macros.
Fixes #5283
1 parent d8f64b6 commit 88a1b56

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clippy_lints/src/lifetimes.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use matches::matches;
22
use rustc::hir::map::Map;
3-
use rustc::lint::in_external_macro;
43
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
54
use rustc_hir::def::{DefKind, Res};
65
use rustc_hir::intravisit::{
@@ -12,13 +11,13 @@ use rustc_hir::{
1211
ItemKind, Lifetime, LifetimeName, ParamName, QPath, TraitBoundModifier, TraitItem, TraitItemKind, TraitMethod, Ty,
1312
TyKind, WhereClause, WherePredicate,
1413
};
15-
use rustc_lint::{LateContext, LateLintPass, LintContext};
14+
use rustc_lint::{LateContext, LateLintPass};
1615
use rustc_session::{declare_lint_pass, declare_tool_lint};
1716
use rustc_span::source_map::Span;
1817
use rustc_span::symbol::kw;
1918

2019
use crate::reexport::Name;
21-
use crate::utils::{last_path_segment, span_lint, trait_ref_of_method};
20+
use crate::utils::{in_macro, last_path_segment, span_lint, trait_ref_of_method};
2221

2322
declare_clippy_lint! {
2423
/// **What it does:** Checks for lifetime annotations which can be removed by
@@ -126,7 +125,7 @@ fn check_fn_inner<'a, 'tcx>(
126125
span: Span,
127126
report_extra_lifetimes: bool,
128127
) {
129-
if in_external_macro(cx.sess(), span) || has_where_lifetimes(cx, &generics.where_clause) {
128+
if in_macro(span) || has_where_lifetimes(cx, &generics.where_clause) {
130129
return;
131130
}
132131

0 commit comments

Comments
 (0)