From 203ad28021ddad978285f2533bdb678bed05f2e3 Mon Sep 17 00:00:00 2001 From: flip1995 <9744647+flip1995@users.noreply.github.com> Date: Mon, 25 Jun 2018 11:53:00 +0200 Subject: [PATCH] resolve merge of NameAndSpan and ExpnInfo rust-lang/rust#51726 --- clippy_lints/src/misc.rs | 2 +- clippy_lints/src/utils/mod.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index a1cb1910e20..414e507a55b 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -558,7 +558,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool { .ctxt() .outer() .expn_info() - .map_or(false, |info| matches!(info.callee.format, ExpnFormat::MacroAttribute(_))) + .map_or(false, |info| matches!(info.format, ExpnFormat::MacroAttribute(_))) } /// Test whether `def` is a variable defined outside a macro. diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index 3adc65a2543..ae8ffcf2fce 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -57,7 +57,7 @@ pub fn in_constant(cx: &LateContext, id: NodeId) -> bool { /// Returns true if this `expn_info` was expanded by any macro. pub fn in_macro(span: Span) -> bool { span.ctxt().outer().expn_info().map_or(false, |info| { - match info.callee.format { + match info.format { // don't treat range expressions desugared to structs as "in_macro" ExpnFormat::CompilerDesugaring(kind) => kind != CompilerDesugaringKind::DotFill, _ => true, @@ -68,7 +68,7 @@ pub fn in_macro(span: Span) -> bool { /// Returns true if `expn_info` was expanded by range expressions. pub fn is_range_expression(span: Span) -> bool { span.ctxt().outer().expn_info().map_or(false, |info| { - match info.callee.format { + match info.format { ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::DotFill) => true, _ => false, } @@ -84,12 +84,12 @@ pub fn in_external_macro<'a, T: LintContext<'a>>(cx: &T, span: Span) -> bool { /// this after other checks have already happened. fn in_macro_ext<'a, T: LintContext<'a>>(cx: &T, info: &ExpnInfo) -> bool { // no ExpnInfo = no macro - if let ExpnFormat::MacroAttribute(..) = info.callee.format { + if let ExpnFormat::MacroAttribute(..) = info.format { // these are all plugins return true; } // no span for the callee = external macro - info.callee.span.map_or(true, |span| { + info.def_site.map_or(true, |span| { // no snippet = external macro or compiler-builtin expansion cx.sess() .codemap() @@ -768,7 +768,7 @@ pub fn is_expn_of(mut span: Span, name: &str) -> Option { let span_name_span = span.ctxt() .outer() .expn_info() - .map(|ei| (ei.callee.name(), ei.call_site)); + .map(|ei| (ei.format.name(), ei.call_site)); match span_name_span { Some((mac_name, new_span)) if mac_name == name => return Some(new_span), @@ -791,7 +791,7 @@ pub fn is_direct_expn_of(span: Span, name: &str) -> Option { let span_name_span = span.ctxt() .outer() .expn_info() - .map(|ei| (ei.callee.name(), ei.call_site)); + .map(|ei| (ei.format.name(), ei.call_site)); match span_name_span { Some((mac_name, new_span)) if mac_name == name => Some(new_span),