From 61230f4cb822081ee17e8a660bc45a7b6ed0220d Mon Sep 17 00:00:00 2001 From: Yawara ISHIDA Date: Fri, 16 Apr 2021 22:50:04 +0900 Subject: [PATCH] Fixed incosistent_struct_constructor triggers in macro-generated code --- clippy_lints/src/inconsistent_struct_constructor.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/clippy_lints/src/inconsistent_struct_constructor.rs b/clippy_lints/src/inconsistent_struct_constructor.rs index d7ca24487a88..7532f182360b 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();