Skip to content

Commit 20febf7

Browse files
committed
Remove unneeded in_external_macro call
1 parent e765258 commit 20febf7

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clippy_lints/src/needless_borrow.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ use rustc_ast::util::parser::PREC_POSTFIX;
1010
use rustc_data_structures::fx::FxIndexMap;
1111
use rustc_errors::Applicability;
1212
use rustc_hir::{BindingAnnotation, Body, BodyId, BorrowKind, Expr, ExprKind, HirId, Mutability, Pat, PatKind, UnOp};
13-
use rustc_lint::{LateContext, LateLintPass, LintContext};
14-
use rustc_middle::lint::in_external_macro;
13+
use rustc_lint::{LateContext, LateLintPass};
1514
use rustc_middle::ty;
1615
use rustc_middle::ty::adjustment::{Adjust, Adjustment};
1716
use rustc_session::{declare_tool_lint, impl_lint_pass};
@@ -161,11 +160,10 @@ impl<'tcx> LateLintPass<'tcx> for NeedlessBorrow {
161160
}
162161

163162
if_chain! {
164-
if !in_external_macro(cx.sess(), pat.span);
163+
if !in_macro(pat.span);
165164
if let ty::Ref(_, tam, _) = *cx.typeck_results().pat_ty(pat).kind();
166165
// only lint immutable refs, because borrowed `&mut T` cannot be moved out
167166
if let ty::Ref(_, _, Mutability::Not) = *tam.kind();
168-
if !in_macro(pat.span);
169167
then {
170168
let mut app = Applicability::MachineApplicable;
171169
let snip = snippet_with_context(cx, name.span, pat.span.ctxt(), "..", &mut app).0;

0 commit comments

Comments
 (0)