about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYawara ISHIDA <ni732h.sphl@gmail.com>2021-04-16 22:50:04 +0900
committerYawara ISHIDA <ni732h.sphl@gmail.com>2021-04-16 22:50:04 +0900
commit61230f4cb822081ee17e8a660bc45a7b6ed0220d (patch)
tree3db59d9de0d7704ef1e620d33af53de264eb6856
parentfaa97568a0ed3804339bec3becc2dda54ccdcafc (diff)
downloadrust-61230f4cb822081ee17e8a660bc45a7b6ed0220d.tar.gz
rust-61230f4cb822081ee17e8a660bc45a7b6ed0220d.zip
Fixed incosistent_struct_constructor triggers in macro-generated code
-rw-r--r--clippy_lints/src/inconsistent_struct_constructor.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/clippy_lints/src/inconsistent_struct_constructor.rs b/clippy_lints/src/inconsistent_struct_constructor.rs
index d7ca24487a8..7532f182360 100644
--- a/clippy_lints/src/inconsistent_struct_constructor.rs
+++ b/clippy_lints/src/inconsistent_struct_constructor.rs
@@ -66,6 +66,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 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();