diff options
| author | bors <bors@rust-lang.org> | 2021-04-20 08:26:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-04-20 08:26:21 +0000 |
| commit | ec38ea1ac1eac8efad1880fe33c49d65b8c4591c (patch) | |
| tree | 56575e2583edf3c13765e4a059693ce9fb00d24c /clippy_lints/src/inconsistent_struct_constructor.rs | |
| parent | b7c12f3aab940cf3b75a1e195989c0722f9ffe46 (diff) | |
| parent | 6eae905808fe830a731ed37e3f4a6264ae98e129 (diff) | |
| download | rust-ec38ea1ac1eac8efad1880fe33c49d65b8c4591c.tar.gz rust-ec38ea1ac1eac8efad1880fe33c49d65b8c4591c.zip | |
Auto merge of #7097 - yawara:fix/7069, r=llogiq
Fixed inconsistent_struct_constructor triggers in macro-generated code fixes #7069 changelog: `inconsistent_struct_constructor`: Fix FP in macro expansion.
Diffstat (limited to 'clippy_lints/src/inconsistent_struct_constructor.rs')
| -rw-r--r-- | clippy_lints/src/inconsistent_struct_constructor.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_lints/src/inconsistent_struct_constructor.rs b/clippy_lints/src/inconsistent_struct_constructor.rs index d7ca24487a8..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,6 +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 !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(); |
