Skip to content

Commit e513ecc

Browse files
committed
Fix explicit_deref_methods triggering from within proc macros
Signed-off-by: Justus Flügel <justusfluegel@gmail.com>
1 parent 9f02cbc commit e513ecc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

clippy_lints/src/dereference.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use clippy_utils::source::{snippet_with_applicability, snippet_with_context};
33
use clippy_utils::sugg::has_enclosing_paren;
44
use clippy_utils::ty::{adjust_derefs_manually_drop, implements_trait, is_manually_drop, peel_and_count_ty_refs};
55
use clippy_utils::{
6-
DefinedTy, ExprUseNode, expr_use_ctxt, get_parent_expr, is_block_like, is_lint_allowed, path_to_local,
6+
DefinedTy, ExprUseNode, expr_use_ctxt, get_parent_expr, is_block_like, is_from_proc_macro, is_lint_allowed,
7+
path_to_local,
78
};
89
use rustc_ast::util::parser::ExprPrecedence;
910
use rustc_data_structures::fx::FxIndexMap;
@@ -260,6 +261,13 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
260261
};
261262
self.skip_expr = skip_expr;
262263

264+
if is_from_proc_macro(cx, expr) {
265+
if let Some((state, data)) = self.state.take() {
266+
report(cx, expr, state, data, cx.typeck_results());
267+
}
268+
return;
269+
}
270+
263271
match (self.state.take(), kind) {
264272
(None, kind) => {
265273
let expr_ty = typeck.expr_ty(expr);

0 commit comments

Comments
 (0)