We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c720020 commit ac37507Copy full SHA for ac37507
clippy_lints/src/redundant_field_names.rs
@@ -2,6 +2,7 @@ use crate::utils::span_lint_and_sugg;
2
use rustc_ast::ast::{Expr, ExprKind};
3
use rustc_errors::Applicability;
4
use rustc_lint::{EarlyContext, EarlyLintPass};
5
+use rustc_middle::lint::in_external_macro;
6
use rustc_session::{declare_lint_pass, declare_tool_lint};
7
8
declare_clippy_lint! {
@@ -36,6 +37,9 @@ declare_lint_pass!(RedundantFieldNames => [REDUNDANT_FIELD_NAMES]);
36
37
38
impl EarlyLintPass for RedundantFieldNames {
39
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
40
+ if in_external_macro(cx.sess, expr.span) {
41
+ return;
42
+ }
43
if let ExprKind::Struct(_, ref fields, _) = expr.kind {
44
for field in fields {
45
if field.is_shorthand {
0 commit comments