Skip to content

Commit b9c8e68

Browse files
committed
Disable default_trait_access in macros
1 parent 841244d commit b9c8e68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clippy_lints/src/default.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_sugg};
22
use clippy_utils::source::snippet_with_macro_callsite;
3-
use clippy_utils::{any_parent_is_automatically_derived, contains_name, match_def_path, paths};
3+
use clippy_utils::{any_parent_is_automatically_derived, contains_name, in_macro, match_def_path, paths};
44
use if_chain::if_chain;
55
use rustc_data_structures::fx::FxHashSet;
66
use rustc_errors::Applicability;
@@ -75,6 +75,7 @@ impl_lint_pass!(Default => [DEFAULT_TRAIT_ACCESS, FIELD_REASSIGN_WITH_DEFAULT]);
7575
impl LateLintPass<'_> for Default {
7676
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
7777
if_chain! {
78+
if !in_macro(expr.span);
7879
// Avoid cases already linted by `field_reassign_with_default`
7980
if !self.reassigned_linted.contains(&expr.span);
8081
if let ExprKind::Call(path, ..) = expr.kind;

0 commit comments

Comments
 (0)