diff options
| author | bors <bors@rust-lang.org> | 2021-07-11 08:46:43 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-11 08:46:43 +0000 |
| commit | 4581c4ef6ff388dd624bdceb484fb03c33d7bae4 (patch) | |
| tree | 734a1f1bf766994dac153ee2c5c0ed2ddba6c16e /src | |
| parent | 0d76b7374589c45e3e9290309781a1ed9a461951 (diff) | |
| parent | 4ba91a063d2c22587bca2c89740214ac7f4ab8d9 (diff) | |
Auto merge of #87042 - petrochenkov:cleanquotspan, r=Aaron1011
Cleanup span quoting I finally got to reviewing https://github.com/rust-lang/rust/pull/84278. See the individual commit messages. r? `@Aaron1011`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/hygiene/unpretty-debug.stdout | 2 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/meta-macro-hygiene.stdout | 6 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/nonterminal-token-hygiene.stdout | 6 | ||||
| -rw-r--r-- | src/test/ui/proc-macro/span-from-proc-macro.stderr | 8 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/misc.rs | 9 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_lints/src/unit_types/unit_cmp.rs | 7 | ||||
| -rw-r--r-- | src/tools/clippy/clippy_utils/src/lib.rs | 14 |
7 files changed, 15 insertions, 37 deletions
diff --git a/src/test/ui/hygiene/unpretty-debug.stdout b/src/test/ui/hygiene/unpretty-debug.stdout index ae2857d505e..84ca046212d 100644 --- a/src/test/ui/hygiene/unpretty-debug.stdout +++ b/src/test/ui/hygiene/unpretty-debug.stdout @@ -20,7 +20,7 @@ fn y /* 0#0 */() { } /* Expansions: 0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root -1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "foo", proc_macro: false } +1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "foo") SyntaxContexts: #0: parent: #0, outer_mark: (ExpnId(0), Opaque) diff --git a/src/test/ui/proc-macro/meta-macro-hygiene.stdout b/src/test/ui/proc-macro/meta-macro-hygiene.stdout index 368326e0216..dc63d014451 100644 --- a/src/test/ui/proc-macro/meta-macro-hygiene.stdout +++ b/src/test/ui/proc-macro/meta-macro-hygiene.stdout @@ -45,10 +45,10 @@ fn main /* 0#0 */() { ; } Expansions: 0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root 1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) -2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "produce_it", proc_macro: false } +2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "produce_it") 3: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) -4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "meta_macro::print_def_site", proc_macro: true } -5: parent: ExpnId(4), call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "$crate::dummy", proc_macro: true } +4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #0, kind: Macro(Bang, "meta_macro::print_def_site") +5: parent: ExpnId(4), call_site_ctxt: #5, def_site_ctxt: #0, kind: Macro(Bang, "$crate::dummy") SyntaxContexts: #0: parent: #0, outer_mark: (ExpnId(0), Opaque) diff --git a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout index 2911707fdb0..75e6a49b314 100644 --- a/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout +++ b/src/test/ui/proc-macro/nonterminal-token-hygiene.stdout @@ -69,10 +69,10 @@ fn main /* 0#0 */() { } Expansions: 0: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Root 1: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) -2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "outer", proc_macro: false } +2: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: Macro(Bang, "outer") 3: parent: ExpnId(0), call_site_ctxt: #0, def_site_ctxt: #0, kind: AstPass(StdImports) -4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #4, kind: Macro { kind: Bang, name: "inner", proc_macro: false } -5: parent: ExpnId(4), call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro { kind: Bang, name: "print_bang", proc_macro: true } +4: parent: ExpnId(2), call_site_ctxt: #4, def_site_ctxt: #4, kind: Macro(Bang, "inner") +5: parent: ExpnId(4), call_site_ctxt: #6, def_site_ctxt: #0, kind: Macro(Bang, "print_bang") SyntaxContexts: #0: parent: #0, outer_mark: (ExpnId(0), Opaque) diff --git a/src/test/ui/proc-macro/span-from-proc-macro.stderr b/src/test/ui/proc-macro/span-from-proc-macro.stderr index 2cbe91afacd..9152ee60a7e 100644 --- a/src/test/ui/proc-macro/span-from-proc-macro.stderr +++ b/src/test/ui/proc-macro/span-from-proc-macro.stderr @@ -2,7 +2,7 @@ error[E0412]: cannot find type `MissingType` in this scope --> $DIR/auxiliary/span-from-proc-macro.rs:37:20 | LL | pub fn error_from_attribute(_args: TokenStream, _input: TokenStream) -> TokenStream { - | ----------------------------------------------------------------------------------- in this expansion of procedural macro `#[error_from_attribute]` + | ----------------------------------------------------------------------------------- in this expansion of `#[error_from_attribute]` ... LL | field: MissingType | ^^^^^^^^^^^ not found in this scope @@ -16,7 +16,7 @@ error[E0412]: cannot find type `OtherMissingType` in this scope --> $DIR/auxiliary/span-from-proc-macro.rs:46:21 | LL | pub fn error_from_derive(_input: TokenStream) -> TokenStream { - | ------------------------------------------------------------ in this expansion of procedural macro `#[derive(ErrorFromDerive)]` + | ------------------------------------------------------------ in this expansion of `#[derive(ErrorFromDerive)]` ... LL | Variant(OtherMissingType) | ^^^^^^^^^^^^^^^^ not found in this scope @@ -30,7 +30,7 @@ error[E0425]: cannot find value `my_ident` in this scope --> $DIR/auxiliary/span-from-proc-macro.rs:29:9 | LL | pub fn other_error_from_bang(_input: TokenStream) -> TokenStream { - | ---------------------------------------------------------------- in this expansion of procedural macro `other_error_from_bang!` + | ---------------------------------------------------------------- in this expansion of `other_error_from_bang!` LL | custom_quote::custom_quote! { LL | my_ident | ^^^^^^^^ not found in this scope @@ -49,7 +49,7 @@ LL | let bang_error: bool = 25; | expected due to this ... LL | pub fn error_from_bang(_input: TokenStream) -> TokenStream { - | ---------------------------------------------------------- in this expansion of procedural macro `error_from_bang!` + | ---------------------------------------------------------- in this expansion of `error_from_bang!` | ::: $DIR/span-from-proc-macro.rs:15:5 | diff --git a/src/tools/clippy/clippy_lints/src/misc.rs b/src/tools/clippy/clippy_lints/src/misc.rs index 804c04fe1b8..7cfce2e61cc 100644 --- a/src/tools/clippy/clippy_lints/src/misc.rs +++ b/src/tools/clippy/clippy_lints/src/misc.rs @@ -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 } diff --git a/src/tools/clippy/clippy_lints/src/unit_types/unit_cmp.rs b/src/tools/clippy/clippy_lints/src/unit_types/unit_cmp.rs index 04542146516..85257f3113c 100644 --- a/src/tools/clippy/clippy_lints/src/unit_types/unit_cmp.rs +++ b/src/tools/clippy/clippy_lints/src/unit_types/unit_cmp.rs @@ -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() { diff --git a/src/tools/clippy/clippy_utils/src/lib.rs b/src/tools/clippy/clippy_utils/src/lib.rs index 217a1f4dded..2f10472180f 100644 --- a/src/tools/clippy/clippy_utils/src/lib.rs +++ b/src/tools/clippy/clippy_utils/src/lib.rs @@ -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); } |
