about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCameron Steffen <cam.steffen94@gmail.com>2021-04-27 21:03:48 -0500
committerCameron Steffen <cam.steffen94@gmail.com>2021-05-01 16:16:32 -0500
commitb9c8e683d609d204fd1192e236a92099d94cbef2 (patch)
treed3ed050dd6468d9d6bbad193f5af824aff65e3b5
parent841244dff039f6ac344d34da30b63b14a3a4f5c3 (diff)
downloadrust-b9c8e683d609d204fd1192e236a92099d94cbef2.tar.gz
rust-b9c8e683d609d204fd1192e236a92099d94cbef2.zip
Disable default_trait_access in macros
-rw-r--r--clippy_lints/src/default.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/default.rs b/clippy_lints/src/default.rs
index 710da8fe9e0..7a53d390bb4 100644
--- a/clippy_lints/src/default.rs
+++ b/clippy_lints/src/default.rs
@@ -1,6 +1,6 @@
 use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_sugg};
 use clippy_utils::source::snippet_with_macro_callsite;
-use clippy_utils::{any_parent_is_automatically_derived, contains_name, match_def_path, paths};
+use clippy_utils::{any_parent_is_automatically_derived, contains_name, in_macro, match_def_path, paths};
 use if_chain::if_chain;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::Applicability;
@@ -75,6 +75,7 @@ impl_lint_pass!(Default => [DEFAULT_TRAIT_ACCESS, FIELD_REASSIGN_WITH_DEFAULT]);
 impl LateLintPass<'_> for Default {
     fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
         if_chain! {
+            if !in_macro(expr.span);
             // Avoid cases already linted by `field_reassign_with_default`
             if !self.reassigned_linted.contains(&expr.span);
             if let ExprKind::Call(path, ..) = expr.kind;