diff options
| author | Yawara ISHIDA <ni732h.sphl@gmail.com> | 2021-04-20 13:33:39 +0900 |
|---|---|---|
| committer | Yawara ISHIDA <ni732h.sphl@gmail.com> | 2021-04-20 13:34:30 +0900 |
| commit | 6eae905808fe830a731ed37e3f4a6264ae98e129 (patch) | |
| tree | d46dd36b0e8ef61f6b8a9d02ace0ef9f5350d0c1 /clippy_lints/src/inconsistent_struct_constructor.rs | |
| parent | 61230f4cb822081ee17e8a660bc45a7b6ed0220d (diff) | |
| download | rust-6eae905808fe830a731ed37e3f4a6264ae98e129.tar.gz rust-6eae905808fe830a731ed37e3f4a6264ae98e129.zip | |
Add a test for FP in macro expansion
Diffstat (limited to 'clippy_lints/src/inconsistent_struct_constructor.rs')
| -rw-r--r-- | clippy_lints/src/inconsistent_struct_constructor.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clippy_lints/src/inconsistent_struct_constructor.rs b/clippy_lints/src/inconsistent_struct_constructor.rs index 7532f182360..d138c3a8acf 100644 --- a/clippy_lints/src/inconsistent_struct_constructor.rs +++ b/clippy_lints/src/inconsistent_struct_constructor.rs @@ -1,4 +1,5 @@ use clippy_utils::diagnostics::span_lint_and_sugg; +use clippy_utils::in_macro; use clippy_utils::source::snippet; use if_chain::if_chain; use rustc_data_structures::fx::FxHashMap; @@ -66,7 +67,7 @@ declare_lint_pass!(InconsistentStructConstructor => [INCONSISTENT_STRUCT_CONSTRU impl LateLintPass<'_> for InconsistentStructConstructor { fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) { if_chain! { - if !expr.span.from_expansion(); + if !in_macro(expr.span); if let ExprKind::Struct(qpath, fields, base) = expr.kind; let ty = cx.typeck_results().expr_ty(expr); if let Some(adt_def) = ty.ty_adt_def(); |
