Skip to content

Commit 203ad28

Browse files
committed
resolve merge of NameAndSpan and ExpnInfo rust-lang/rust#51726
1 parent 535c168 commit 203ad28

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clippy_lints/src/misc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ fn in_attributes_expansion(expr: &Expr) -> bool {
558558
.ctxt()
559559
.outer()
560560
.expn_info()
561-
.map_or(false, |info| matches!(info.callee.format, ExpnFormat::MacroAttribute(_)))
561+
.map_or(false, |info| matches!(info.format, ExpnFormat::MacroAttribute(_)))
562562
}
563563

564564
/// Test whether `def` is a variable defined outside a macro.

clippy_lints/src/utils/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn in_constant(cx: &LateContext, id: NodeId) -> bool {
5757
/// Returns true if this `expn_info` was expanded by any macro.
5858
pub fn in_macro(span: Span) -> bool {
5959
span.ctxt().outer().expn_info().map_or(false, |info| {
60-
match info.callee.format {
60+
match info.format {
6161
// don't treat range expressions desugared to structs as "in_macro"
6262
ExpnFormat::CompilerDesugaring(kind) => kind != CompilerDesugaringKind::DotFill,
6363
_ => true,
@@ -68,7 +68,7 @@ pub fn in_macro(span: Span) -> bool {
6868
/// Returns true if `expn_info` was expanded by range expressions.
6969
pub fn is_range_expression(span: Span) -> bool {
7070
span.ctxt().outer().expn_info().map_or(false, |info| {
71-
match info.callee.format {
71+
match info.format {
7272
ExpnFormat::CompilerDesugaring(CompilerDesugaringKind::DotFill) => true,
7373
_ => false,
7474
}
@@ -84,12 +84,12 @@ pub fn in_external_macro<'a, T: LintContext<'a>>(cx: &T, span: Span) -> bool {
8484
/// this after other checks have already happened.
8585
fn in_macro_ext<'a, T: LintContext<'a>>(cx: &T, info: &ExpnInfo) -> bool {
8686
// no ExpnInfo = no macro
87-
if let ExpnFormat::MacroAttribute(..) = info.callee.format {
87+
if let ExpnFormat::MacroAttribute(..) = info.format {
8888
// these are all plugins
8989
return true;
9090
}
9191
// no span for the callee = external macro
92-
info.callee.span.map_or(true, |span| {
92+
info.def_site.map_or(true, |span| {
9393
// no snippet = external macro or compiler-builtin expansion
9494
cx.sess()
9595
.codemap()
@@ -768,7 +768,7 @@ pub fn is_expn_of(mut span: Span, name: &str) -> Option<Span> {
768768
let span_name_span = span.ctxt()
769769
.outer()
770770
.expn_info()
771-
.map(|ei| (ei.callee.name(), ei.call_site));
771+
.map(|ei| (ei.format.name(), ei.call_site));
772772

773773
match span_name_span {
774774
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<Span> {
791791
let span_name_span = span.ctxt()
792792
.outer()
793793
.expn_info()
794-
.map(|ei| (ei.callee.name(), ei.call_site));
794+
.map(|ei| (ei.format.name(), ei.call_site));
795795

796796
match span_name_span {
797797
Some((mac_name, new_span)) if mac_name == name => Some(new_span),

0 commit comments

Comments
 (0)