mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
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`.
This commit is contained in:
parent
3fc34455f4
commit
075a28996c
3 changed files with 4 additions and 26 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue