Skip to content

Commit

Permalink
rustc_span: Revert addition of proc_macro field to ExpnKind::Macro
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
petrochenkov committed Jul 10, 2021
1 parent 3fc3445 commit 075a289
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
9 changes: 1 addition & 8 deletions clippy_lints/src/misc.rs
Expand Up @@ -662,14 +662,7 @@ fn in_attributes_expansion(expr: &Expr<'_>) -> bool {
use rustc_span::hygiene::MacroKind;
if expr.span.from_expansion() {
let data = expr.span.ctxt().outer_expn_data();
matches!(
data.kind,
ExpnKind::Macro {
kind: MacroKind::Attr,
name: _,
proc_macro: _
}
)
matches!(data.kind, ExpnKind::Macro(MacroKind::Attr, _))
} else {
false
}
Expand Down
7 changes: 1 addition & 6 deletions clippy_lints/src/unit_types/unit_cmp.rs
Expand Up @@ -8,12 +8,7 @@ use super::UNIT_CMP;
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
if expr.span.from_expansion() {
if let Some(callee) = expr.span.source_callee() {
if let ExpnKind::Macro {
kind: MacroKind::Bang,
name: symbol,
proc_macro: _,
} = callee.kind
{
if let ExpnKind::Macro(MacroKind::Bang, symbol) = callee.kind {
if let ExprKind::Binary(ref cmp, left, _) = expr.kind {
let op = cmp.node;
if op.is_comparison() && cx.typeck_results().expr_ty(left).is_unit() {
Expand Down
14 changes: 2 additions & 12 deletions clippy_utils/src/lib.rs
Expand Up @@ -953,12 +953,7 @@ pub fn is_expn_of(mut span: Span, name: &str) -> Option<Span> {
let data = span.ctxt().outer_expn_data();
let new_span = data.call_site;

if let ExpnKind::Macro {
kind: MacroKind::Bang,
name: mac_name,
proc_macro: _,
} = data.kind
{
if let ExpnKind::Macro(MacroKind::Bang, mac_name) = data.kind {
if mac_name.as_str() == name {
return Some(new_span);
}
Expand Down Expand Up @@ -986,12 +981,7 @@ pub fn is_direct_expn_of(span: Span, name: &str) -> Option<Span> {
let data = span.ctxt().outer_expn_data();
let new_span = data.call_site;

if let ExpnKind::Macro {
kind: MacroKind::Bang,
name: mac_name,
proc_macro: _,
} = data.kind
{
if let ExpnKind::Macro(MacroKind::Bang, mac_name) = data.kind {
if mac_name.as_str() == name {
return Some(new_span);
}
Expand Down

0 comments on commit 075a289

Please sign in to comment.