Skip to content

Commit 40349b2

Browse files
committed
Fix breakage from rust-lang/rust#52949
1 parent f43d0e5 commit 40349b2

File tree

2 files changed

+4
-20
lines changed

2 files changed

+4
-20
lines changed

clippy_lints/src/redundant_field_names.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use rustc::lint::*;
22
use rustc::{declare_lint, lint_array};
33
use rustc::hir::*;
4-
use crate::utils::{in_macro, is_range_expression, match_var, span_lint_and_sugg};
4+
use crate::utils::{in_macro, match_var, span_lint_and_sugg};
55

66
/// **What it does:** Checks for fields in struct literals where shorthands
77
/// could be used.
@@ -40,7 +40,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantFieldNames {
4040
// Ignore all macros including range expressions.
4141
// They can have redundant field names when expanded.
4242
// e.g. range expression `start..end` is desugared to `Range { start: start, end: end }`
43-
if in_macro(expr.span) || is_range_expression(expr.span) {
43+
if in_macro(expr.span) {
4444
return;
4545
}
4646

clippy_lints/src/utils/mod.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use std::str::FromStr;
1919
use std::rc::Rc;
2020
use syntax::ast::{self, LitKind};
2121
use syntax::attr;
22-
use syntax::codemap::{CompilerDesugaringKind, ExpnFormat, Span, DUMMY_SP};
22+
use syntax::codemap::{Span, DUMMY_SP};
2323
use syntax::errors::DiagnosticBuilder;
2424
use syntax::ptr::P;
2525
use syntax::symbol::keywords;
@@ -58,23 +58,7 @@ pub fn in_constant(cx: &LateContext<'_, '_>, id: NodeId) -> bool {
5858

5959
/// Returns true if this `expn_info` was expanded by any macro.
6060
pub fn in_macro(span: Span) -> bool {
61-
span.ctxt().outer().expn_info().map_or(false, |info| {
62-
match info.format {
63-
// don't treat range expressions desugared to structs as "in_macro"
64-
ExpnFormat::CompilerDesugaring(kind) => kind != CompilerDesugaringKind::DotFill,
65-
_ => true,
66-
}
67-
})
68-
}
69-
70-
/// Returns true if `expn_info` was expanded by range expressions.
71-
pub fn is_range_expression(span: Span) -> bool {
72-
span.ctxt().outer().expn_info().map_or(false, |info| {
73-
match info.format {
74-
ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::DotFill) => true,
75-
_ => false,
76-
}
77-
})
61+
span.ctxt().outer().expn_info().is_some()
7862
}
7963

8064
/// Check if a `DefId`'s path matches the given absolute type path usage.

0 commit comments

Comments
 (0)