|
1 | 1 | use clippy_utils::diagnostics::{span_lint_and_note, span_lint_and_sugg}; |
2 | 2 | use clippy_utils::source::snippet_with_macro_callsite; |
3 | 3 | use clippy_utils::ty::{has_drop, is_copy}; |
4 | | -use clippy_utils::{any_parent_is_automatically_derived, contains_name, in_macro, match_def_path, paths}; |
| 4 | +use clippy_utils::{any_parent_is_automatically_derived, contains_name, match_def_path, paths}; |
5 | 5 | use if_chain::if_chain; |
6 | 6 | use rustc_data_structures::fx::FxHashSet; |
7 | 7 | use rustc_errors::Applicability; |
@@ -78,7 +78,7 @@ impl_lint_pass!(Default => [DEFAULT_TRAIT_ACCESS, FIELD_REASSIGN_WITH_DEFAULT]); |
78 | 78 | impl LateLintPass<'_> for Default { |
79 | 79 | fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) { |
80 | 80 | if_chain! { |
81 | | - if !in_macro(expr.span); |
| 81 | + if !expr.span.from_expansion(); |
82 | 82 | // Avoid cases already linted by `field_reassign_with_default` |
83 | 83 | if !self.reassigned_linted.contains(&expr.span); |
84 | 84 | if let ExprKind::Call(path, ..) = expr.kind; |
@@ -125,7 +125,7 @@ impl LateLintPass<'_> for Default { |
125 | 125 | if let StmtKind::Local(local) = stmt.kind; |
126 | 126 | if let Some(expr) = local.init; |
127 | 127 | if !any_parent_is_automatically_derived(cx.tcx, expr.hir_id); |
128 | | - if !in_macro(expr.span); |
| 128 | + if !expr.span.from_expansion(); |
129 | 129 | // only take bindings to identifiers |
130 | 130 | if let PatKind::Binding(_, binding_id, ident, _) = local.pat.kind; |
131 | 131 | // only when assigning `... = Default::default()` |
|
0 commit comments