Skip to content

Commit

Permalink
Fix fallout in redundant_field_names
Browse files Browse the repository at this point in the history
  • Loading branch information
flip1995 committed Jun 16, 2020
1 parent f7acea2 commit 485229c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clippy_lints/src/redundant_field_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::utils::span_lint_and_sugg;
use rustc_ast::ast::{Expr, ExprKind};
use rustc_errors::Applicability;
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_middle::lint::in_external_macro;
use rustc_session::{declare_lint_pass, declare_tool_lint};

declare_clippy_lint! {
Expand Down Expand Up @@ -36,6 +37,9 @@ declare_lint_pass!(RedundantFieldNames => [REDUNDANT_FIELD_NAMES]);

impl EarlyLintPass for RedundantFieldNames {
fn check_expr(&mut self, cx: &EarlyContext<'_>, expr: &Expr) {
if in_external_macro(cx.sess, expr.span) {
return;
}
if let ExprKind::Struct(_, ref fields, _) = expr.kind {
for field in fields {
if field.is_shorthand {
Expand Down

0 comments on commit 485229c

Please sign in to comment.