Skip to content

Commit 075a289

Browse files
committed
rustc_span: Revert addition of proc_macro field to ExpnKind::Macro
The flag has a vague meaning and is used for a single diagnostic change that is low benefit and appears only under `-Z macro_backtrace`.
1 parent 3fc3445 commit 075a289

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

clippy_lints/src/misc.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -662,14 +662,7 @@ fn in_attributes_expansion(expr: &Expr<'_>) -> bool {
662662
use rustc_span::hygiene::MacroKind;
663663
if expr.span.from_expansion() {
664664
let data = expr.span.ctxt().outer_expn_data();
665-
matches!(
666-
data.kind,
667-
ExpnKind::Macro {
668-
kind: MacroKind::Attr,
669-
name: _,
670-
proc_macro: _
671-
}
672-
)
665+
matches!(data.kind, ExpnKind::Macro(MacroKind::Attr, _))
673666
} else {
674667
false
675668
}

clippy_lints/src/unit_types/unit_cmp.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ use super::UNIT_CMP;
88
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
99
if expr.span.from_expansion() {
1010
if let Some(callee) = expr.span.source_callee() {
11-
if let ExpnKind::Macro {
12-
kind: MacroKind::Bang,
13-
name: symbol,
14-
proc_macro: _,
15-
} = callee.kind
16-
{
11+
if let ExpnKind::Macro(MacroKind::Bang, symbol) = callee.kind {
1712
if let ExprKind::Binary(ref cmp, left, _) = expr.kind {
1813
let op = cmp.node;
1914
if op.is_comparison() && cx.typeck_results().expr_ty(left).is_unit() {

clippy_utils/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -953,12 +953,7 @@ pub fn is_expn_of(mut span: Span, name: &str) -> Option<Span> {
953953
let data = span.ctxt().outer_expn_data();
954954
let new_span = data.call_site;
955955

956-
if let ExpnKind::Macro {
957-
kind: MacroKind::Bang,
958-
name: mac_name,
959-
proc_macro: _,
960-
} = data.kind
961-
{
956+
if let ExpnKind::Macro(MacroKind::Bang, mac_name) = data.kind {
962957
if mac_name.as_str() == name {
963958
return Some(new_span);
964959
}
@@ -986,12 +981,7 @@ pub fn is_direct_expn_of(span: Span, name: &str) -> Option<Span> {
986981
let data = span.ctxt().outer_expn_data();
987982
let new_span = data.call_site;
988983

989-
if let ExpnKind::Macro {
990-
kind: MacroKind::Bang,
991-
name: mac_name,
992-
proc_macro: _,
993-
} = data.kind
994-
{
984+
if let ExpnKind::Macro(MacroKind::Bang, mac_name) = data.kind {
995985
if mac_name.as_str() == name {
996986
return Some(new_span);
997987
}

0 commit comments

Comments
 (0)