about summary refs log tree commit diff
path: root/compiler/rustc_builtin_macros
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-09-22 19:05:04 -0400
committerMichael Goulet <michael@errs.io>2024-09-22 19:11:29 -0400
commitc682aa162b0d41e21cc6748f4fecfe01efb69d1f (patch)
tree0c31b640e3faacfb187a1509e3da5d5b6ba0109c /compiler/rustc_builtin_macros
parent1173204b364841b51598744fc69d7c80be10f956 (diff)
downloadrust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.tar.gz
rust-c682aa162b0d41e21cc6748f4fecfe01efb69d1f.zip
Reformat using the new identifier sorting from rustfmt
Diffstat (limited to 'compiler/rustc_builtin_macros')
-rw-r--r--compiler/rustc_builtin_macros/src/alloc_error_handler.rs13
-rw-r--r--compiler/rustc_builtin_macros/src/asm.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/assert.rs6
-rw-r--r--compiler/rustc_builtin_macros/src/assert/context.rs8
-rw-r--r--compiler/rustc_builtin_macros/src/cfg_accessible.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/cfg_eval.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/cmdline_attrs.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/concat_bytes.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/concat_idents.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/derive.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/clone.rs26
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs15
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/debug.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/decodable.rs69
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/default.rs14
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/encodable.rs93
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/generic/mod.rs20
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/generic/ty.rs6
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/hash.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/mod.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs6
-rw-r--r--compiler/rustc_builtin_macros/src/edition_panic.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/env.rs12
-rw-r--r--compiler/rustc_builtin_macros/src/format.rs3
-rw-r--r--compiler/rustc_builtin_macros/src/format_foreign.rs12
-rw-r--r--compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs12
-rw-r--r--compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs11
-rw-r--r--compiler/rustc_builtin_macros/src/global_allocator.rs6
-rw-r--r--compiler/rustc_builtin_macros/src/pattern_type.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/proc_macro_harness.rs65
-rw-r--r--compiler/rustc_builtin_macros/src/source_util.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/standard_library_imports.rs4
-rw-r--r--compiler/rustc_builtin_macros/src/test.rs307
-rw-r--r--compiler/rustc_builtin_macros/src/test_harness.rs14
-rw-r--r--compiler/rustc_builtin_macros/src/trace_macros.rs2
-rw-r--r--compiler/rustc_builtin_macros/src/util.rs4
39 files changed, 346 insertions, 428 deletions
diff --git a/compiler/rustc_builtin_macros/src/alloc_error_handler.rs b/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
index 1df2812e0c8..0caad997b9d 100644
--- a/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
+++ b/compiler/rustc_builtin_macros/src/alloc_error_handler.rs
@@ -3,9 +3,9 @@ use rustc_ast::{
     self as ast, Fn, FnHeader, FnSig, Generics, ItemKind, Safety, Stmt, StmtKind, TyKind,
 };
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{kw, sym, Ident};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, kw, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::errors;
 use crate::util::check_builtin_macro_attribute;
@@ -68,11 +68,10 @@ fn generate_handler(cx: &ExtCtxt<'_>, handler: Ident, span: Span, sig_span: Span
 
     let layout_new = cx.std_path(&[sym::alloc, sym::Layout, sym::from_size_align_unchecked]);
     let layout_new = cx.expr_path(cx.path(span, layout_new));
-    let layout = cx.expr_call(
-        span,
-        layout_new,
-        thin_vec![cx.expr_ident(span, size), cx.expr_ident(span, align)],
-    );
+    let layout = cx.expr_call(span, layout_new, thin_vec![
+        cx.expr_ident(span, size),
+        cx.expr_ident(span, align)
+    ]);
 
     let call = cx.expr_call_ident(sig_span, handler, thin_vec![layout]);
 
diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs
index 0e1ec3b3cad..94e40da8c92 100644
--- a/compiler/rustc_builtin_macros/src/asm.rs
+++ b/compiler/rustc_builtin_macros/src/asm.rs
@@ -1,16 +1,16 @@
 use ast::token::IdentIsRaw;
 use lint::BuiltinLintDiag;
+use rustc_ast::AsmMacro;
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Delimiter};
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::AsmMacro;
 use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
 use rustc_errors::PResult;
 use rustc_expand::base::*;
 use rustc_index::bit_set::GrowableBitSet;
 use rustc_parse::parser::Parser;
 use rustc_session::lint;
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
 use rustc_span::{ErrorGuaranteed, InnerSpan, Span};
 use rustc_target::asm::InlineAsmArch;
 use smallvec::smallvec;
diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs
index 99f433c0851..71449350985 100644
--- a/compiler/rustc_builtin_macros/src/assert.rs
+++ b/compiler/rustc_builtin_macros/src/assert.rs
@@ -3,13 +3,13 @@ mod context;
 use rustc_ast::ptr::P;
 use rustc_ast::token::Delimiter;
 use rustc_ast::tokenstream::{DelimSpan, TokenStream};
-use rustc_ast::{token, DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment, UnOp};
+use rustc_ast::{DelimArgs, Expr, ExprKind, MacCall, Path, PathSegment, UnOp, token};
 use rustc_ast_pretty::pprust;
 use rustc_errors::PResult;
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
 use rustc_parse::parser::Parser;
-use rustc_span::symbol::{sym, Ident, Symbol};
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use rustc_span::{DUMMY_SP, Span};
 use thin_vec::thin_vec;
 
 use crate::edition_panic::use_panic_2021;
diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs
index 2cd5b9d68a0..70fa4d00c0f 100644
--- a/compiler/rustc_builtin_macros/src/assert/context.rs
+++ b/compiler/rustc_builtin_macros/src/assert/context.rs
@@ -2,15 +2,15 @@ use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Delimiter, IdentIsRaw};
 use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
 use rustc_ast::{
-    BinOpKind, BorrowKind, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall, Mutability,
-    Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind, DUMMY_NODE_ID,
+    BinOpKind, BorrowKind, DUMMY_NODE_ID, DelimArgs, Expr, ExprKind, ItemKind, MacCall, MethodCall,
+    Mutability, Path, PathSegment, Stmt, StructRest, UnOp, UseTree, UseTreeKind,
 };
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_expand::base::ExtCtxt;
-use rustc_span::symbol::{sym, Ident, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 pub(super) struct Context<'cx, 'a> {
     // An optimization.
diff --git a/compiler/rustc_builtin_macros/src/cfg_accessible.rs b/compiler/rustc_builtin_macros/src/cfg_accessible.rs
index 3d3bd3aea05..23578781a83 100644
--- a/compiler/rustc_builtin_macros/src/cfg_accessible.rs
+++ b/compiler/rustc_builtin_macros/src/cfg_accessible.rs
@@ -4,8 +4,8 @@ use rustc_ast as ast;
 use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, Indeterminate, MultiItemModifier};
 use rustc_feature::AttributeTemplate;
 use rustc_parse::validate_attr;
-use rustc_span::symbol::sym;
 use rustc_span::Span;
+use rustc_span::symbol::sym;
 
 use crate::errors;
 
diff --git a/compiler/rustc_builtin_macros/src/cfg_eval.rs b/compiler/rustc_builtin_macros/src/cfg_eval.rs
index 4b05c144d37..b686a8cf935 100644
--- a/compiler/rustc_builtin_macros/src/cfg_eval.rs
+++ b/compiler/rustc_builtin_macros/src/cfg_eval.rs
@@ -4,7 +4,7 @@ use rustc_ast as ast;
 use rustc_ast::mut_visit::MutVisitor;
 use rustc_ast::ptr::P;
 use rustc_ast::visit::{AssocCtxt, Visitor};
-use rustc_ast::{mut_visit, visit, Attribute, HasAttrs, HasTokens, NodeId};
+use rustc_ast::{Attribute, HasAttrs, HasTokens, NodeId, mut_visit, visit};
 use rustc_errors::PResult;
 use rustc_expand::base::{Annotatable, ExtCtxt};
 use rustc_expand::config::StripUnconfigured;
@@ -12,8 +12,8 @@ use rustc_expand::configure;
 use rustc_feature::Features;
 use rustc_parse::parser::{ForceCollect, Parser};
 use rustc_session::Session;
-use rustc_span::symbol::sym;
 use rustc_span::Span;
+use rustc_span::symbol::sym;
 use smallvec::SmallVec;
 use tracing::instrument;
 
diff --git a/compiler/rustc_builtin_macros/src/cmdline_attrs.rs b/compiler/rustc_builtin_macros/src/cmdline_attrs.rs
index 66fa74da60d..6afd8c4b43b 100644
--- a/compiler/rustc_builtin_macros/src/cmdline_attrs.rs
+++ b/compiler/rustc_builtin_macros/src/cmdline_attrs.rs
@@ -1,7 +1,7 @@
 //! Attributes injected into the crate root from command line using `-Z crate-attr`.
 
 use rustc_ast::attr::mk_attr;
-use rustc_ast::{self as ast, token, AttrItem, AttrStyle};
+use rustc_ast::{self as ast, AttrItem, AttrStyle, token};
 use rustc_parse::parser::ForceCollect;
 use rustc_parse::{new_parser_from_source_str, unwrap_or_emit_fatal};
 use rustc_session::parse::ParseSess;
diff --git a/compiler/rustc_builtin_macros/src/concat_bytes.rs b/compiler/rustc_builtin_macros/src/concat_bytes.rs
index 196bf906dc0..456f2b9ab31 100644
--- a/compiler/rustc_builtin_macros/src/concat_bytes.rs
+++ b/compiler/rustc_builtin_macros/src/concat_bytes.rs
@@ -1,6 +1,6 @@
 use rustc_ast::ptr::P;
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::{token, ExprKind, LitIntType, LitKind, UintTy};
+use rustc_ast::{ExprKind, LitIntType, LitKind, UintTy, token};
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
 use rustc_session::errors::report_lit_error;
 use rustc_span::{ErrorGuaranteed, Span};
diff --git a/compiler/rustc_builtin_macros/src/concat_idents.rs b/compiler/rustc_builtin_macros/src/concat_idents.rs
index 13729a9d250..b459cc3007d 100644
--- a/compiler/rustc_builtin_macros/src/concat_idents.rs
+++ b/compiler/rustc_builtin_macros/src/concat_idents.rs
@@ -1,10 +1,10 @@
 use rustc_ast::ptr::P;
 use rustc_ast::token::{self, Token};
 use rustc_ast::tokenstream::{TokenStream, TokenTree};
-use rustc_ast::{AttrVec, Expr, ExprKind, Path, Ty, TyKind, DUMMY_NODE_ID};
+use rustc_ast::{AttrVec, DUMMY_NODE_ID, Expr, ExprKind, Path, Ty, TyKind};
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacResult, MacroExpanderResult};
-use rustc_span::symbol::{Ident, Symbol};
 use rustc_span::Span;
+use rustc_span::symbol::{Ident, Symbol};
 
 use crate::errors;
 
diff --git a/compiler/rustc_builtin_macros/src/derive.rs b/compiler/rustc_builtin_macros/src/derive.rs
index e8704bc2f63..4be2d209ae7 100644
--- a/compiler/rustc_builtin_macros/src/derive.rs
+++ b/compiler/rustc_builtin_macros/src/derive.rs
@@ -6,7 +6,7 @@ use rustc_expand::base::{
 use rustc_feature::AttributeTemplate;
 use rustc_parse::validate_attr;
 use rustc_session::Session;
-use rustc_span::symbol::{sym, Ident};
+use rustc_span::symbol::{Ident, sym};
 use rustc_span::{ErrorGuaranteed, Span};
 
 use crate::cfg_eval::cfg_eval;
diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs
index 22beca4ea9a..dde696fca61 100644
--- a/compiler/rustc_builtin_macros/src/deriving/clone.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs
@@ -1,9 +1,9 @@
 use rustc_ast::{self as ast, Generics, ItemKind, MetaItem, VariantData};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{kw, sym, Ident};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, kw, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
@@ -115,13 +115,10 @@ fn cs_clone_simple(
                 // type parameters.
             } else if !field.ty.kind.is_anon_adt() {
                 // let _: AssertParamIsClone<FieldTy>;
-                super::assert_ty_bounds(
-                    cx,
-                    &mut stmts,
-                    field.ty.clone(),
-                    field.span,
-                    &[sym::clone, sym::AssertParamIsClone],
-                );
+                super::assert_ty_bounds(cx, &mut stmts, field.ty.clone(), field.span, &[
+                    sym::clone,
+                    sym::AssertParamIsClone,
+                ]);
             }
         }
     };
@@ -130,13 +127,10 @@ fn cs_clone_simple(
         // Just a single assertion for unions, that the union impls `Copy`.
         // let _: AssertParamIsCopy<Self>;
         let self_ty = cx.ty_path(cx.path_ident(trait_span, Ident::with_dummy_span(kw::SelfUpper)));
-        super::assert_ty_bounds(
-            cx,
-            &mut stmts,
-            self_ty,
-            trait_span,
-            &[sym::clone, sym::AssertParamIsCopy],
-        );
+        super::assert_ty_bounds(cx, &mut stmts, self_ty, trait_span, &[
+            sym::clone,
+            sym::AssertParamIsCopy,
+        ]);
     } else {
         match *substr.fields {
             StaticStruct(vdata, ..) => {
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs
index a5e12174796..bd6f4eb8d99 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/eq.rs
@@ -1,9 +1,9 @@
 use rustc_ast::{self as ast, MetaItem};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::sym;
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::sym;
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
@@ -66,13 +66,10 @@ fn cs_total_eq_assert(
                 // Already produced an assertion for this type.
             } else {
                 // let _: AssertParamIsEq<FieldTy>;
-                super::assert_ty_bounds(
-                    cx,
-                    &mut stmts,
-                    field.ty.clone(),
-                    field.span,
-                    &[sym::cmp, sym::AssertParamIsEq],
-                );
+                super::assert_ty_bounds(cx, &mut stmts, field.ty.clone(), field.span, &[
+                    sym::cmp,
+                    sym::AssertParamIsEq,
+                ]);
             }
         }
     };
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
index 705c41175e7..433cbfaa6cb 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/ord.rs
@@ -1,7 +1,7 @@
 use rustc_ast::MetaItem;
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{sym, Ident};
 use rustc_span::Span;
+use rustc_span::symbol::{Ident, sym};
 use thin_vec::thin_vec;
 
 use crate::deriving::generic::ty::*;
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs
index f6299589e0f..ae1e5f4a219 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_eq.rs
@@ -1,8 +1,8 @@
 use rustc_ast::ptr::P;
 use rustc_ast::{BinOpKind, BorrowKind, Expr, ExprKind, MetaItem, Mutability};
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::sym;
 use rustc_span::Span;
+use rustc_span::symbol::sym;
 use thin_vec::thin_vec;
 
 use crate::deriving::generic::ty::*;
diff --git a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
index a51f98f5396..99a98325053 100644
--- a/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/cmp/partial_ord.rs
@@ -1,7 +1,7 @@
 use rustc_ast::{ExprKind, ItemKind, MetaItem, PatKind};
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{sym, Ident};
 use rustc_span::Span;
+use rustc_span::symbol::{Ident, sym};
 use thin_vec::thin_vec;
 
 use crate::deriving::generic::ty::*;
diff --git a/compiler/rustc_builtin_macros/src/deriving/debug.rs b/compiler/rustc_builtin_macros/src/deriving/debug.rs
index 57d9c076150..06a598cf3b0 100644
--- a/compiler/rustc_builtin_macros/src/deriving/debug.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/debug.rs
@@ -1,9 +1,9 @@
 use rustc_ast::{self as ast, EnumDef, MetaItem};
 use rustc_expand::base::{Annotatable, ExtCtxt};
 use rustc_session::config::FmtDebug;
-use rustc_span::symbol::{sym, Ident, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs
index 89300a36d1b..686424770fc 100644
--- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs
@@ -3,9 +3,9 @@
 use rustc_ast::ptr::P;
 use rustc_ast::{self as ast, Expr, MetaItem, Mutability};
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{sym, Ident, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
@@ -32,10 +32,11 @@ pub(crate) fn expand_deriving_rustc_decodable(
         methods: vec![MethodDef {
             name: sym::decode,
             generics: Bounds {
-                bounds: vec![(
-                    typaram,
-                    vec![Path::new_(vec![krate, sym::Decoder], vec![], PathKind::Global)],
-                )],
+                bounds: vec![(typaram, vec![Path::new_(
+                    vec![krate, sym::Decoder],
+                    vec![],
+                    PathKind::Global,
+                )])],
             },
             explicit_self: false,
             nonself_args: vec![(
@@ -94,32 +95,24 @@ fn decodable_substructure(
                 decode_static_fields(cx, trait_span, path, summary, |cx, span, name, field| {
                     cx.expr_try(
                         span,
-                        cx.expr_call_global(
-                            span,
-                            fn_read_struct_field_path.clone(),
-                            thin_vec![
-                                blkdecoder.clone(),
-                                cx.expr_str(span, name),
-                                cx.expr_usize(span, field),
-                                exprdecode.clone(),
-                            ],
-                        ),
+                        cx.expr_call_global(span, fn_read_struct_field_path.clone(), thin_vec![
+                            blkdecoder.clone(),
+                            cx.expr_str(span, name),
+                            cx.expr_usize(span, field),
+                            exprdecode.clone(),
+                        ]),
                     )
                 });
             let result = cx.expr_ok(trait_span, result);
             let fn_read_struct_path: Vec<_> =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_struct]);
 
-            cx.expr_call_global(
-                trait_span,
-                fn_read_struct_path,
-                thin_vec![
-                    decoder,
-                    cx.expr_str(trait_span, substr.type_ident.name),
-                    cx.expr_usize(trait_span, nfields),
-                    cx.lambda1(trait_span, result, blkarg),
-                ],
-            )
+            cx.expr_call_global(trait_span, fn_read_struct_path, thin_vec![
+                decoder,
+                cx.expr_str(trait_span, substr.type_ident.name),
+                cx.expr_usize(trait_span, nfields),
+                cx.lambda1(trait_span, result, blkarg),
+            ])
         }
         StaticEnum(_, fields) => {
             let variant = Ident::new(sym::i, trait_span);
@@ -160,23 +153,19 @@ fn decodable_substructure(
             let variant_array_ref = cx.expr_array_ref(trait_span, variants);
             let fn_read_enum_variant_path: Vec<_> =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum_variant]);
-            let result = cx.expr_call_global(
-                trait_span,
-                fn_read_enum_variant_path,
-                thin_vec![blkdecoder, variant_array_ref, lambda],
-            );
+            let result = cx.expr_call_global(trait_span, fn_read_enum_variant_path, thin_vec![
+                blkdecoder,
+                variant_array_ref,
+                lambda
+            ]);
             let fn_read_enum_path: Vec<_> =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum]);
 
-            cx.expr_call_global(
-                trait_span,
-                fn_read_enum_path,
-                thin_vec![
-                    decoder,
-                    cx.expr_str(trait_span, substr.type_ident.name),
-                    cx.lambda1(trait_span, result, blkarg),
-                ],
-            )
+            cx.expr_call_global(trait_span, fn_read_enum_path, thin_vec![
+                decoder,
+                cx.expr_str(trait_span, substr.type_ident.name),
+                cx.lambda1(trait_span, result, blkarg),
+            ])
         }
         _ => cx.dcx().bug("expected StaticEnum or StaticStruct in derive(Decodable)"),
     };
diff --git a/compiler/rustc_builtin_macros/src/deriving/default.rs b/compiler/rustc_builtin_macros/src/deriving/default.rs
index afc55ddd230..652e6f7740f 100644
--- a/compiler/rustc_builtin_macros/src/deriving/default.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/default.rs
@@ -2,12 +2,12 @@ use core::ops::ControlFlow;
 
 use rustc_ast as ast;
 use rustc_ast::visit::visit_opt;
-use rustc_ast::{attr, EnumDef, VariantData};
+use rustc_ast::{EnumDef, VariantData, attr};
 use rustc_expand::base::{Annotatable, DummyResult, ExtCtxt};
-use rustc_span::symbol::{kw, sym, Ident};
+use rustc_span::symbol::{Ident, kw, sym};
 use rustc_span::{ErrorGuaranteed, Span};
 use smallvec::SmallVec;
-use thin_vec::{thin_vec, ThinVec};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
@@ -93,10 +93,10 @@ fn default_enum_substructure(
     } {
         Ok(default_variant) => {
             // We now know there is exactly one unit variant with exactly one `#[default]` attribute.
-            cx.expr_path(cx.path(
-                default_variant.span,
-                vec![Ident::new(kw::SelfUpper, default_variant.span), default_variant.ident],
-            ))
+            cx.expr_path(cx.path(default_variant.span, vec![
+                Ident::new(kw::SelfUpper, default_variant.span),
+                default_variant.ident,
+            ]))
         }
         Err(guar) => DummyResult::raw_expr(trait_span, Some(guar)),
     };
diff --git a/compiler/rustc_builtin_macros/src/deriving/encodable.rs b/compiler/rustc_builtin_macros/src/deriving/encodable.rs
index 9c26d05f811..5c7583f2a77 100644
--- a/compiler/rustc_builtin_macros/src/deriving/encodable.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/encodable.rs
@@ -87,9 +87,9 @@
 
 use rustc_ast::{AttrVec, ExprKind, MetaItem, Mutability};
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{sym, Ident, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::deriving::generic::ty::*;
 use crate::deriving::generic::*;
@@ -116,10 +116,11 @@ pub(crate) fn expand_deriving_rustc_encodable(
         methods: vec![MethodDef {
             name: sym::encode,
             generics: Bounds {
-                bounds: vec![(
-                    typaram,
-                    vec![Path::new_(vec![krate, sym::Encoder], vec![], PathKind::Global)],
-                )],
+                bounds: vec![(typaram, vec![Path::new_(
+                    vec![krate, sym::Encoder],
+                    vec![],
+                    PathKind::Global,
+                )])],
             },
             explicit_self: true,
             nonself_args: vec![(
@@ -157,14 +158,11 @@ fn encodable_substructure(
     // throw an underscore in front to suppress unused variable warnings
     let blkarg = Ident::new(sym::_e, trait_span);
     let blkencoder = cx.expr_ident(trait_span, blkarg);
-    let fn_path = cx.expr_path(cx.path_global(
-        trait_span,
-        vec![
-            Ident::new(krate, trait_span),
-            Ident::new(sym::Encodable, trait_span),
-            Ident::new(sym::encode, trait_span),
-        ],
-    ));
+    let fn_path = cx.expr_path(cx.path_global(trait_span, vec![
+        Ident::new(krate, trait_span),
+        Ident::new(sym::Encodable, trait_span),
+        Ident::new(sym::encode, trait_span),
+    ]));
 
     match substr.fields {
         Struct(_, fields) => {
@@ -180,16 +178,12 @@ fn encodable_substructure(
                 let enc =
                     cx.expr_call(span, fn_path.clone(), thin_vec![self_ref, blkencoder.clone()]);
                 let lambda = cx.lambda1(span, enc, blkarg);
-                let call = cx.expr_call_global(
-                    span,
-                    fn_emit_struct_field_path.clone(),
-                    thin_vec![
-                        blkencoder.clone(),
-                        cx.expr_str(span, name),
-                        cx.expr_usize(span, i),
-                        lambda,
-                    ],
-                );
+                let call = cx.expr_call_global(span, fn_emit_struct_field_path.clone(), thin_vec![
+                    blkencoder.clone(),
+                    cx.expr_str(span, name),
+                    cx.expr_usize(span, i),
+                    lambda,
+                ]);
 
                 // last call doesn't need a try!
                 let last = fields.len() - 1;
@@ -214,16 +208,12 @@ fn encodable_substructure(
             let fn_emit_struct_path =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_struct]);
 
-            let expr = cx.expr_call_global(
-                trait_span,
-                fn_emit_struct_path,
-                thin_vec![
-                    encoder,
-                    cx.expr_str(trait_span, substr.type_ident.name),
-                    cx.expr_usize(trait_span, fields.len()),
-                    blk,
-                ],
-            );
+            let expr = cx.expr_call_global(trait_span, fn_emit_struct_path, thin_vec![
+                encoder,
+                cx.expr_str(trait_span, substr.type_ident.name),
+                cx.expr_usize(trait_span, fields.len()),
+                blk,
+            ]);
             BlockOrExpr::new_expr(expr)
         }
 
@@ -243,11 +233,8 @@ fn encodable_substructure(
                 let last = fields.len() - 1;
                 for (i, &FieldInfo { ref self_expr, span, .. }) in fields.iter().enumerate() {
                     let self_ref = cx.expr_addr_of(span, self_expr.clone());
-                    let enc = cx.expr_call(
-                        span,
-                        fn_path.clone(),
-                        thin_vec![self_ref, blkencoder.clone()],
-                    );
+                    let enc = cx
+                        .expr_call(span, fn_path.clone(), thin_vec![self_ref, blkencoder.clone()]);
                     let lambda = cx.lambda1(span, enc, blkarg);
 
                     let call = cx.expr_call_global(
@@ -274,26 +261,22 @@ fn encodable_substructure(
             let fn_emit_enum_variant_path: Vec<_> =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum_variant]);
 
-            let call = cx.expr_call_global(
-                trait_span,
-                fn_emit_enum_variant_path,
-                thin_vec![
-                    blkencoder,
-                    name,
-                    cx.expr_usize(trait_span, *idx),
-                    cx.expr_usize(trait_span, fields.len()),
-                    blk,
-                ],
-            );
+            let call = cx.expr_call_global(trait_span, fn_emit_enum_variant_path, thin_vec![
+                blkencoder,
+                name,
+                cx.expr_usize(trait_span, *idx),
+                cx.expr_usize(trait_span, fields.len()),
+                blk,
+            ]);
 
             let blk = cx.lambda1(trait_span, call, blkarg);
             let fn_emit_enum_path: Vec<_> =
                 cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum]);
-            let expr = cx.expr_call_global(
-                trait_span,
-                fn_emit_enum_path,
-                thin_vec![encoder, cx.expr_str(trait_span, substr.type_ident.name), blk],
-            );
+            let expr = cx.expr_call_global(trait_span, fn_emit_enum_path, thin_vec![
+                encoder,
+                cx.expr_str(trait_span, substr.type_ident.name),
+                blk
+            ]);
             BlockOrExpr::new_mixed(thin_vec![me], Some(expr))
         }
 
diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
index 289e92a69b2..82baaca9a46 100644
--- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs
@@ -178,6 +178,8 @@ use std::cell::RefCell;
 use std::ops::Not;
 use std::{iter, vec};
 
+pub(crate) use StaticFields::*;
+pub(crate) use SubstructureFields::*;
 use rustc_ast::ptr::P;
 use rustc_ast::{
     self as ast, BindingMode, ByRef, EnumDef, Expr, GenericArg, GenericParamKind, Generics,
@@ -185,12 +187,10 @@ use rustc_ast::{
 };
 use rustc_attr as attr;
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::{Span, DUMMY_SP};
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
+use rustc_span::{DUMMY_SP, Span};
+use thin_vec::{ThinVec, thin_vec};
 use ty::{Bounds, Path, Ref, Self_, Ty};
-pub(crate) use StaticFields::*;
-pub(crate) use SubstructureFields::*;
 
 use crate::{deriving, errors};
 
@@ -1228,12 +1228,10 @@ impl<'a> MethodDef<'a> {
 
             let discr_let_stmts: ThinVec<_> = iter::zip(&discr_idents, &selflike_args)
                 .map(|(&ident, selflike_arg)| {
-                    let variant_value = deriving::call_intrinsic(
-                        cx,
-                        span,
-                        sym::discriminant_value,
-                        thin_vec![selflike_arg.clone()],
-                    );
+                    let variant_value =
+                        deriving::call_intrinsic(cx, span, sym::discriminant_value, thin_vec![
+                            selflike_arg.clone()
+                        ]);
                     cx.stmt_let(span, false, ident, variant_value)
                 })
                 .collect();
diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs
index 42855e255a8..b118cbfbd91 100644
--- a/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/generic/ty.rs
@@ -1,14 +1,14 @@
 //! A mini version of ast::Ty, which is easier to use, and features an explicit `Self` type to use
 //! when specifying impls to be derived.
 
+pub(crate) use Ty::*;
 use rustc_ast::ptr::P;
 use rustc_ast::{self as ast, Expr, GenericArg, GenericParamKind, Generics, SelfKind};
 use rustc_expand::base::ExtCtxt;
 use rustc_span::source_map::respan;
-use rustc_span::symbol::{kw, Ident, Symbol};
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::symbol::{Ident, Symbol, kw};
+use rustc_span::{DUMMY_SP, Span};
 use thin_vec::ThinVec;
-pub(crate) use Ty::*;
 
 /// A path, e.g., `::std::option::Option::<i32>` (global). Has support
 /// for type parameters.
diff --git a/compiler/rustc_builtin_macros/src/deriving/hash.rs b/compiler/rustc_builtin_macros/src/deriving/hash.rs
index 4fa6686b7b3..2d1f5b70f77 100644
--- a/compiler/rustc_builtin_macros/src/deriving/hash.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/hash.rs
@@ -1,7 +1,7 @@
 use rustc_ast::{MetaItem, Mutability};
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::sym;
 use rustc_span::Span;
+use rustc_span::symbol::sym;
 use thin_vec::thin_vec;
 
 use crate::deriving::generic::ty::*;
diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs
index 32936ac183d..d5ee5e430d5 100644
--- a/compiler/rustc_builtin_macros/src/deriving/mod.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs
@@ -4,9 +4,9 @@ use rustc_ast as ast;
 use rustc_ast::ptr::P;
 use rustc_ast::{GenericArg, MetaItem};
 use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt, MultiItemModifier};
-use rustc_span::symbol::{sym, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Symbol, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 macro path_local($x:ident) {
     generic::ty::Path::new_local(sym::$x)
diff --git a/compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs b/compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs
index bc41d33a609..12749e87dcb 100644
--- a/compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs
+++ b/compiler/rustc_builtin_macros/src/deriving/smart_ptr.rs
@@ -1,5 +1,5 @@
-use ast::ptr::P;
 use ast::HasAttrs;
+use ast::ptr::P;
 use rustc_ast::mut_visit::MutVisitor;
 use rustc_ast::visit::BoundKind;
 use rustc_ast::{
@@ -9,9 +9,9 @@ use rustc_ast::{
 use rustc_attr as attr;
 use rustc_data_structures::flat_map_in_place::FlatMapInPlace;
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{sym, Ident};
+use rustc_span::symbol::{Ident, sym};
 use rustc_span::{Span, Symbol};
-use thin_vec::{thin_vec, ThinVec};
+use thin_vec::{ThinVec, thin_vec};
 
 macro_rules! path {
     ($span:expr, $($part:ident)::*) => { vec![$(Ident::new(sym::$part, $span),)*] }
diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs
index cc385bade47..c4164a7db9a 100644
--- a/compiler/rustc_builtin_macros/src/edition_panic.rs
+++ b/compiler/rustc_builtin_macros/src/edition_panic.rs
@@ -3,9 +3,9 @@ use rustc_ast::token::Delimiter;
 use rustc_ast::tokenstream::{DelimSpan, TokenStream};
 use rustc_ast::*;
 use rustc_expand::base::*;
+use rustc_span::Span;
 use rustc_span::edition::Edition;
 use rustc_span::symbol::sym;
-use rustc_span::Span;
 
 /// This expands to either
 /// - `$crate::panic::panic_2015!(...)` or
diff --git a/compiler/rustc_builtin_macros/src/env.rs b/compiler/rustc_builtin_macros/src/env.rs
index 1a4fc65f0a8..25583cda5a2 100644
--- a/compiler/rustc_builtin_macros/src/env.rs
+++ b/compiler/rustc_builtin_macros/src/env.rs
@@ -10,8 +10,8 @@ use rustc_ast::token::{self, LitKind};
 use rustc_ast::tokenstream::TokenStream;
 use rustc_ast::{AstDeref, ExprKind, GenericArg, Mutability};
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacEager, MacroExpanderResult};
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::Span;
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
 use thin_vec::thin_vec;
 
 use crate::errors;
@@ -58,11 +58,11 @@ pub(crate) fn expand_option_env<'cx>(
                 ))],
             ))
         }
-        Some(value) => cx.expr_call_global(
-            sp,
-            cx.std_path(&[sym::option, sym::Option, sym::Some]),
-            thin_vec![cx.expr_str(sp, value)],
-        ),
+        Some(value) => {
+            cx.expr_call_global(sp, cx.std_path(&[sym::option, sym::Option, sym::Some]), thin_vec![
+                cx.expr_str(sp, value)
+            ])
+        }
     };
     ExpandResult::Ready(MacEager::expr(e))
 }
diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs
index f99530cad18..9501e93bad5 100644
--- a/compiler/rustc_builtin_macros/src/format.rs
+++ b/compiler/rustc_builtin_macros/src/format.rs
@@ -2,9 +2,10 @@ use parse::Position::ArgumentNamed;
 use rustc_ast::ptr::P;
 use rustc_ast::tokenstream::TokenStream;
 use rustc_ast::{
-    token, Expr, ExprKind, FormatAlignment, FormatArgPosition, FormatArgPositionKind, FormatArgs,
+    Expr, ExprKind, FormatAlignment, FormatArgPosition, FormatArgPositionKind, FormatArgs,
     FormatArgsPiece, FormatArgument, FormatArgumentKind, FormatArguments, FormatCount,
     FormatDebugHex, FormatOptions, FormatPlaceholder, FormatSign, FormatTrait, Recovered, StmtKind,
+    token,
 };
 use rustc_data_structures::fx::FxHashSet;
 use rustc_errors::{Applicability, Diag, MultiSpan, PResult, SingleLabelManySpans};
diff --git a/compiler/rustc_builtin_macros/src/format_foreign.rs b/compiler/rustc_builtin_macros/src/format_foreign.rs
index 866ec72f116..71320e6d5ad 100644
--- a/compiler/rustc_builtin_macros/src/format_foreign.rs
+++ b/compiler/rustc_builtin_macros/src/format_foreign.rs
@@ -183,14 +183,10 @@ pub(crate) mod printf {
             s.push('{');
 
             if let Some(arg) = self.parameter {
-                match write!(
-                    s,
-                    "{}",
-                    match arg.checked_sub(1) {
-                        Some(a) => a,
-                        None => return Err(None),
-                    }
-                ) {
+                match write!(s, "{}", match arg.checked_sub(1) {
+                    Some(a) => a,
+                    None => return Err(None),
+                }) {
                     Err(_) => return Err(None),
                     _ => {}
                 }
diff --git a/compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs b/compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs
index df773910dbc..8fe06df48e5 100644
--- a/compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs
+++ b/compiler/rustc_builtin_macros/src/format_foreign/printf/tests.rs
@@ -1,4 +1,4 @@
-use super::{iter_subs, parse_next_substitution as pns, Format as F, Num as N, Substitution as S};
+use super::{Format as F, Num as N, Substitution as S, iter_subs, parse_next_substitution as pns};
 
 macro_rules! assert_eq_pnsat {
     ($lhs:expr, $rhs:expr) => {
@@ -99,10 +99,12 @@ fn test_parse() {
 fn test_iter() {
     let s = "The %d'th word %% is: `%.*s` %!\n";
     let subs: Vec<_> = iter_subs(s, 0).map(|sub| sub.translate().ok()).collect();
-    assert_eq!(
-        subs.iter().map(Option::as_deref).collect::<Vec<_>>(),
-        vec![Some("{}"), None, Some("{:.*}"), None]
-    );
+    assert_eq!(subs.iter().map(Option::as_deref).collect::<Vec<_>>(), vec![
+        Some("{}"),
+        None,
+        Some("{:.*}"),
+        None
+    ]);
 }
 
 /// Checks that the translations are what we expect.
diff --git a/compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs b/compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs
index 93a7afcd6e8..dd2ee2b6ca9 100644
--- a/compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs
+++ b/compiler/rustc_builtin_macros/src/format_foreign/shell/tests.rs
@@ -1,4 +1,4 @@
-use super::{parse_next_substitution as pns, Substitution as S};
+use super::{Substitution as S, parse_next_substitution as pns};
 
 macro_rules! assert_eq_pnsat {
     ($lhs:expr, $rhs:expr) => {
@@ -38,10 +38,11 @@ fn test_iter() {
     use super::iter_subs;
     let s = "The $0'th word $$ is: `$WORD` $!\n";
     let subs: Vec<_> = iter_subs(s, 0).map(|sub| sub.translate().ok()).collect();
-    assert_eq!(
-        subs.iter().map(Option::as_deref).collect::<Vec<_>>(),
-        vec![Some("{0}"), None, Some("{WORD}")]
-    );
+    assert_eq!(subs.iter().map(Option::as_deref).collect::<Vec<_>>(), vec![
+        Some("{0}"),
+        None,
+        Some("{WORD}")
+    ]);
 }
 
 #[test]
diff --git a/compiler/rustc_builtin_macros/src/global_allocator.rs b/compiler/rustc_builtin_macros/src/global_allocator.rs
index 66df393b501..b4b18409a18 100644
--- a/compiler/rustc_builtin_macros/src/global_allocator.rs
+++ b/compiler/rustc_builtin_macros/src/global_allocator.rs
@@ -1,5 +1,5 @@
 use rustc_ast::expand::allocator::{
-    global_fn_name, AllocatorMethod, AllocatorMethodInput, AllocatorTy, ALLOCATOR_METHODS,
+    ALLOCATOR_METHODS, AllocatorMethod, AllocatorMethodInput, AllocatorTy, global_fn_name,
 };
 use rustc_ast::ptr::P;
 use rustc_ast::{
@@ -7,9 +7,9 @@ use rustc_ast::{
     Stmt, StmtKind, Ty, TyKind,
 };
 use rustc_expand::base::{Annotatable, ExtCtxt};
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::Span;
-use thin_vec::{thin_vec, ThinVec};
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::errors;
 use crate::util::check_builtin_macro_attribute;
diff --git a/compiler/rustc_builtin_macros/src/pattern_type.rs b/compiler/rustc_builtin_macros/src/pattern_type.rs
index 869d203f68e..90b5f097b32 100644
--- a/compiler/rustc_builtin_macros/src/pattern_type.rs
+++ b/compiler/rustc_builtin_macros/src/pattern_type.rs
@@ -1,9 +1,9 @@
 use rustc_ast::ptr::P;
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::{ast, Pat, Ty};
+use rustc_ast::{Pat, Ty, ast};
 use rustc_errors::PResult;
 use rustc_expand::base::{self, DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
-use rustc_span::{sym, Span};
+use rustc_span::{Span, sym};
 
 pub(crate) fn expand<'cx>(
     cx: &'cx mut ExtCtxt<'_>,
diff --git a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
index 6b2b2b90457..d6603af101a 100644
--- a/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
+++ b/compiler/rustc_builtin_macros/src/proc_macro_harness.rs
@@ -2,19 +2,19 @@ use std::mem;
 
 use rustc_ast::ptr::P;
 use rustc_ast::visit::{self, Visitor};
-use rustc_ast::{self as ast, attr, NodeId};
+use rustc_ast::{self as ast, NodeId, attr};
 use rustc_ast_pretty::pprust;
 use rustc_errors::DiagCtxtHandle;
-use rustc_expand::base::{parse_macro_name_and_helper_attrs, ExtCtxt, ResolverExpand};
+use rustc_expand::base::{ExtCtxt, ResolverExpand, parse_macro_name_and_helper_attrs};
 use rustc_expand::expand::{AstFragment, ExpansionConfig};
 use rustc_feature::Features;
 use rustc_session::Session;
 use rustc_span::hygiene::AstPass;
 use rustc_span::source_map::SourceMap;
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
+use rustc_span::{DUMMY_SP, Span};
 use smallvec::smallvec;
-use thin_vec::{thin_vec, ThinVec};
+use thin_vec::{ThinVec, thin_vec};
 
 use crate::errors;
 
@@ -302,29 +302,25 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
             };
             let local_path = |cx: &ExtCtxt<'_>, name| cx.expr_path(cx.path(span, vec![name]));
             let proc_macro_ty_method_path = |cx: &ExtCtxt<'_>, method| {
-                cx.expr_path(cx.path(
-                    span.with_ctxt(harness_span.ctxt()),
-                    vec![proc_macro, bridge, client, proc_macro_ty, method],
-                ))
+                cx.expr_path(cx.path(span.with_ctxt(harness_span.ctxt()), vec![
+                    proc_macro,
+                    bridge,
+                    client,
+                    proc_macro_ty,
+                    method,
+                ]))
             };
             match m {
                 ProcMacro::Derive(cd) => {
                     cx.resolver.declare_proc_macro(cd.id);
-                    cx.expr_call(
-                        span,
-                        proc_macro_ty_method_path(cx, custom_derive),
-                        thin_vec![
-                            cx.expr_str(span, cd.trait_name),
-                            cx.expr_array_ref(
-                                span,
-                                cd.attrs
-                                    .iter()
-                                    .map(|&s| cx.expr_str(span, s))
-                                    .collect::<ThinVec<_>>(),
-                            ),
-                            local_path(cx, cd.function_name),
-                        ],
-                    )
+                    cx.expr_call(span, proc_macro_ty_method_path(cx, custom_derive), thin_vec![
+                        cx.expr_str(span, cd.trait_name),
+                        cx.expr_array_ref(
+                            span,
+                            cd.attrs.iter().map(|&s| cx.expr_str(span, s)).collect::<ThinVec<_>>(),
+                        ),
+                        local_path(cx, cd.function_name),
+                    ])
                 }
                 ProcMacro::Attr(ca) | ProcMacro::Bang(ca) => {
                     cx.resolver.declare_proc_macro(ca.id);
@@ -334,14 +330,10 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
                         ProcMacro::Derive(_) => unreachable!(),
                     };
 
-                    cx.expr_call(
-                        span,
-                        proc_macro_ty_method_path(cx, ident),
-                        thin_vec![
-                            cx.expr_str(span, ca.function_name.name),
-                            local_path(cx, ca.function_name),
-                        ],
-                    )
+                    cx.expr_call(span, proc_macro_ty_method_path(cx, ident), thin_vec![
+                        cx.expr_str(span, ca.function_name.name),
+                        local_path(cx, ca.function_name),
+                    ])
                 }
             }
         })
@@ -355,9 +347,12 @@ fn mk_decls(cx: &mut ExtCtxt<'_>, macros: &[ProcMacro]) -> P<ast::Item> {
                 span,
                 cx.ty(
                     span,
-                    ast::TyKind::Slice(
-                        cx.ty_path(cx.path(span, vec![proc_macro, bridge, client, proc_macro_ty])),
-                    ),
+                    ast::TyKind::Slice(cx.ty_path(cx.path(span, vec![
+                        proc_macro,
+                        bridge,
+                        client,
+                        proc_macro_ty,
+                    ]))),
                 ),
                 None,
                 ast::Mutability::Not,
diff --git a/compiler/rustc_builtin_macros/src/source_util.rs b/compiler/rustc_builtin_macros/src/source_util.rs
index 9554d97829e..946fbe918e6 100644
--- a/compiler/rustc_builtin_macros/src/source_util.rs
+++ b/compiler/rustc_builtin_macros/src/source_util.rs
@@ -8,7 +8,7 @@ use rustc_ast::tokenstream::TokenStream;
 use rustc_ast_pretty::pprust;
 use rustc_data_structures::sync::Lrc;
 use rustc_expand::base::{
-    resolve_path, DummyResult, ExpandResult, ExtCtxt, MacEager, MacResult, MacroExpanderResult,
+    DummyResult, ExpandResult, ExtCtxt, MacEager, MacResult, MacroExpanderResult, resolve_path,
 };
 use rustc_expand::module::DirOwnership;
 use rustc_lint_defs::BuiltinLintDiag;
@@ -73,8 +73,8 @@ pub(crate) fn expand_file(
     let topmost = cx.expansion_cause().unwrap_or(sp);
     let loc = cx.source_map().lookup_char_pos(topmost.lo());
 
-    use rustc_session::config::RemapPathScopeComponents;
     use rustc_session::RemapFileNameExt;
+    use rustc_session::config::RemapPathScopeComponents;
     ExpandResult::Ready(MacEager::expr(cx.expr_str(
         topmost,
         Symbol::intern(
diff --git a/compiler/rustc_builtin_macros/src/standard_library_imports.rs b/compiler/rustc_builtin_macros/src/standard_library_imports.rs
index 9bcd793c450..a3fc53344ab 100644
--- a/compiler/rustc_builtin_macros/src/standard_library_imports.rs
+++ b/compiler/rustc_builtin_macros/src/standard_library_imports.rs
@@ -3,10 +3,10 @@ use rustc_expand::base::{ExtCtxt, ResolverExpand};
 use rustc_expand::expand::ExpansionConfig;
 use rustc_feature::Features;
 use rustc_session::Session;
+use rustc_span::DUMMY_SP;
 use rustc_span::edition::Edition::*;
 use rustc_span::hygiene::AstPass;
-use rustc_span::symbol::{kw, sym, Ident, Symbol};
-use rustc_span::DUMMY_SP;
+use rustc_span::symbol::{Ident, Symbol, kw, sym};
 use thin_vec::thin_vec;
 
 pub fn inject(
diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs
index 40dc75339ef..664e935ee14 100644
--- a/compiler/rustc_builtin_macros/src/test.rs
+++ b/compiler/rustc_builtin_macros/src/test.rs
@@ -5,13 +5,13 @@ use std::assert_matches::assert_matches;
 use std::iter;
 
 use rustc_ast::ptr::P;
-use rustc_ast::{self as ast, attr, GenericParamKind};
+use rustc_ast::{self as ast, GenericParamKind, attr};
 use rustc_ast_pretty::pprust;
 use rustc_errors::{Applicability, Diag, Level};
 use rustc_expand::base::*;
-use rustc_span::symbol::{sym, Ident, Symbol};
+use rustc_span::symbol::{Ident, Symbol, sym};
 use rustc_span::{ErrorGuaranteed, FileNameDisplayPreference, Span};
-use thin_vec::{thin_vec, ThinVec};
+use thin_vec::{ThinVec, thin_vec};
 use tracing::debug;
 
 use crate::errors;
@@ -170,26 +170,20 @@ pub(crate) fn expand_test_or_bench(
 
     // creates test::ShouldPanic::$name
     let should_panic_path = |name| {
-        cx.path(
-            sp,
-            vec![
-                test_id,
-                Ident::from_str_and_span("ShouldPanic", sp),
-                Ident::from_str_and_span(name, sp),
-            ],
-        )
+        cx.path(sp, vec![
+            test_id,
+            Ident::from_str_and_span("ShouldPanic", sp),
+            Ident::from_str_and_span(name, sp),
+        ])
     };
 
     // creates test::TestType::$name
     let test_type_path = |name| {
-        cx.path(
-            sp,
-            vec![
-                test_id,
-                Ident::from_str_and_span("TestType", sp),
-                Ident::from_str_and_span(name, sp),
-            ],
-        )
+        cx.path(sp, vec![
+            test_id,
+            Ident::from_str_and_span("TestType", sp),
+            Ident::from_str_and_span(name, sp),
+        ])
     };
 
     // creates $name: $expr
@@ -209,55 +203,39 @@ pub(crate) fn expand_test_or_bench(
         // A simple ident for a lambda
         let b = Ident::from_str_and_span("b", attr_sp);
 
-        cx.expr_call(
-            sp,
-            cx.expr_path(test_path("StaticBenchFn")),
-            thin_vec![
-                // #[coverage(off)]
-                // |b| self::test::assert_test_result(
-                coverage_off(cx.lambda1(
-                    sp,
+        cx.expr_call(sp, cx.expr_path(test_path("StaticBenchFn")), thin_vec![
+            // #[coverage(off)]
+            // |b| self::test::assert_test_result(
+            coverage_off(cx.lambda1(
+                sp,
+                cx.expr_call(sp, cx.expr_path(test_path("assert_test_result")), thin_vec![
+                    // super::$test_fn(b)
                     cx.expr_call(
-                        sp,
-                        cx.expr_path(test_path("assert_test_result")),
-                        thin_vec![
-                            // super::$test_fn(b)
-                            cx.expr_call(
-                                ret_ty_sp,
-                                cx.expr_path(cx.path(sp, vec![item.ident])),
-                                thin_vec![cx.expr_ident(sp, b)],
-                            ),
-                        ],
+                        ret_ty_sp,
+                        cx.expr_path(cx.path(sp, vec![item.ident])),
+                        thin_vec![cx.expr_ident(sp, b)],
                     ),
-                    b,
-                )), // )
-            ],
-        )
+                ],),
+                b,
+            )), // )
+        ])
     } else {
-        cx.expr_call(
-            sp,
-            cx.expr_path(test_path("StaticTestFn")),
-            thin_vec![
-                // #[coverage(off)]
-                // || {
-                coverage_off(cx.lambda0(
-                    sp,
-                    // test::assert_test_result(
+        cx.expr_call(sp, cx.expr_path(test_path("StaticTestFn")), thin_vec![
+            // #[coverage(off)]
+            // || {
+            coverage_off(cx.lambda0(
+                sp,
+                // test::assert_test_result(
+                cx.expr_call(sp, cx.expr_path(test_path("assert_test_result")), thin_vec![
+                    // $test_fn()
                     cx.expr_call(
-                        sp,
-                        cx.expr_path(test_path("assert_test_result")),
-                        thin_vec![
-                            // $test_fn()
-                            cx.expr_call(
-                                ret_ty_sp,
-                                cx.expr_path(cx.path(sp, vec![item.ident])),
-                                ThinVec::new(),
-                            ), // )
-                        ],
-                    ), // }
-                )), // )
-            ],
-        )
+                        ret_ty_sp,
+                        cx.expr_path(cx.path(sp, vec![item.ident])),
+                        ThinVec::new(),
+                    ), // )
+                ],), // }
+            )), // )
+        ])
     };
 
     let test_path_symbol = Symbol::intern(&item_path(
@@ -268,122 +246,107 @@ pub(crate) fn expand_test_or_bench(
 
     let location_info = get_location_info(cx, &item);
 
-    let mut test_const =
-        cx.item(
-            sp,
-            Ident::new(item.ident.name, sp),
-            thin_vec![
-                // #[cfg(test)]
-                cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
-                // #[rustc_test_marker = "test_case_sort_key"]
-                cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
-                // #[doc(hidden)]
-                cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
-            ],
-            // const $ident: test::TestDescAndFn =
-            ast::ItemKind::Const(
-                ast::ConstItem {
-                    defaultness: ast::Defaultness::Final,
-                    generics: ast::Generics::default(),
-                    ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
-                    // test::TestDescAndFn {
-                    expr: Some(
-                        cx.expr_struct(
-                            sp,
-                            test_path("TestDescAndFn"),
-                            thin_vec![
+    let mut test_const = cx.item(
+        sp,
+        Ident::new(item.ident.name, sp),
+        thin_vec![
+            // #[cfg(test)]
+            cx.attr_nested_word(sym::cfg, sym::test, attr_sp),
+            // #[rustc_test_marker = "test_case_sort_key"]
+            cx.attr_name_value_str(sym::rustc_test_marker, test_path_symbol, attr_sp),
+            // #[doc(hidden)]
+            cx.attr_nested_word(sym::doc, sym::hidden, attr_sp),
+        ],
+        // const $ident: test::TestDescAndFn =
+        ast::ItemKind::Const(
+            ast::ConstItem {
+                defaultness: ast::Defaultness::Final,
+                generics: ast::Generics::default(),
+                ty: cx.ty(sp, ast::TyKind::Path(None, test_path("TestDescAndFn"))),
+                // test::TestDescAndFn {
+                expr: Some(
+                    cx.expr_struct(sp, test_path("TestDescAndFn"), thin_vec![
                         // desc: test::TestDesc {
                         field(
                             "desc",
-                            cx.expr_struct(
-                                sp,
-                                test_path("TestDesc"),
-                                thin_vec![
-                                    // name: "path::to::test"
-                                    field(
-                                        "name",
-                                        cx.expr_call(
-                                            sp,
-                                            cx.expr_path(test_path("StaticTestName")),
-                                            thin_vec![cx.expr_str(sp, test_path_symbol)],
-                                        ),
+                            cx.expr_struct(sp, test_path("TestDesc"), thin_vec![
+                                // name: "path::to::test"
+                                field(
+                                    "name",
+                                    cx.expr_call(
+                                        sp,
+                                        cx.expr_path(test_path("StaticTestName")),
+                                        thin_vec![cx.expr_str(sp, test_path_symbol)],
                                     ),
-                                    // ignore: true | false
-                                    field("ignore", cx.expr_bool(sp, should_ignore(&item)),),
-                                    // ignore_message: Some("...") | None
-                                    field(
-                                        "ignore_message",
-                                        if let Some(msg) = should_ignore_message(&item) {
-                                            cx.expr_some(sp, cx.expr_str(sp, msg))
-                                        } else {
-                                            cx.expr_none(sp)
-                                        },
+                                ),
+                                // ignore: true | false
+                                field("ignore", cx.expr_bool(sp, should_ignore(&item)),),
+                                // ignore_message: Some("...") | None
+                                field(
+                                    "ignore_message",
+                                    if let Some(msg) = should_ignore_message(&item) {
+                                        cx.expr_some(sp, cx.expr_str(sp, msg))
+                                    } else {
+                                        cx.expr_none(sp)
+                                    },
+                                ),
+                                // source_file: <relative_path_of_source_file>
+                                field("source_file", cx.expr_str(sp, location_info.0)),
+                                // start_line: start line of the test fn identifier.
+                                field("start_line", cx.expr_usize(sp, location_info.1)),
+                                // start_col: start column of the test fn identifier.
+                                field("start_col", cx.expr_usize(sp, location_info.2)),
+                                // end_line: end line of the test fn identifier.
+                                field("end_line", cx.expr_usize(sp, location_info.3)),
+                                // end_col: end column of the test fn identifier.
+                                field("end_col", cx.expr_usize(sp, location_info.4)),
+                                // compile_fail: true | false
+                                field("compile_fail", cx.expr_bool(sp, false)),
+                                // no_run: true | false
+                                field("no_run", cx.expr_bool(sp, false)),
+                                // should_panic: ...
+                                field("should_panic", match should_panic(cx, &item) {
+                                    // test::ShouldPanic::No
+                                    ShouldPanic::No => {
+                                        cx.expr_path(should_panic_path("No"))
+                                    }
+                                    // test::ShouldPanic::Yes
+                                    ShouldPanic::Yes(None) => {
+                                        cx.expr_path(should_panic_path("Yes"))
+                                    }
+                                    // test::ShouldPanic::YesWithMessage("...")
+                                    ShouldPanic::Yes(Some(sym)) => cx.expr_call(
+                                        sp,
+                                        cx.expr_path(should_panic_path("YesWithMessage")),
+                                        thin_vec![cx.expr_str(sp, sym)],
                                     ),
-                                    // source_file: <relative_path_of_source_file>
-                                    field("source_file", cx.expr_str(sp, location_info.0)),
-                                    // start_line: start line of the test fn identifier.
-                                    field("start_line", cx.expr_usize(sp, location_info.1)),
-                                    // start_col: start column of the test fn identifier.
-                                    field("start_col", cx.expr_usize(sp, location_info.2)),
-                                    // end_line: end line of the test fn identifier.
-                                    field("end_line", cx.expr_usize(sp, location_info.3)),
-                                    // end_col: end column of the test fn identifier.
-                                    field("end_col", cx.expr_usize(sp, location_info.4)),
-                                    // compile_fail: true | false
-                                    field("compile_fail", cx.expr_bool(sp, false)),
-                                    // no_run: true | false
-                                    field("no_run", cx.expr_bool(sp, false)),
-                                    // should_panic: ...
-                                    field(
-                                        "should_panic",
-                                        match should_panic(cx, &item) {
-                                            // test::ShouldPanic::No
-                                            ShouldPanic::No => {
-                                                cx.expr_path(should_panic_path("No"))
-                                            }
-                                            // test::ShouldPanic::Yes
-                                            ShouldPanic::Yes(None) => {
-                                                cx.expr_path(should_panic_path("Yes"))
-                                            }
-                                            // test::ShouldPanic::YesWithMessage("...")
-                                            ShouldPanic::Yes(Some(sym)) => cx.expr_call(
-                                                sp,
-                                                cx.expr_path(should_panic_path("YesWithMessage")),
-                                                thin_vec![cx.expr_str(sp, sym)],
-                                            ),
-                                        },
-                                    ),
-                                    // test_type: ...
-                                    field(
-                                        "test_type",
-                                        match test_type(cx) {
-                                            // test::TestType::UnitTest
-                                            TestType::UnitTest => {
-                                                cx.expr_path(test_type_path("UnitTest"))
-                                            }
-                                            // test::TestType::IntegrationTest
-                                            TestType::IntegrationTest => {
-                                                cx.expr_path(test_type_path("IntegrationTest"))
-                                            }
-                                            // test::TestPath::Unknown
-                                            TestType::Unknown => {
-                                                cx.expr_path(test_type_path("Unknown"))
-                                            }
-                                        },
-                                    ),
-                                    // },
-                                ],
-                            ),
+                                },),
+                                // test_type: ...
+                                field("test_type", match test_type(cx) {
+                                    // test::TestType::UnitTest
+                                    TestType::UnitTest => {
+                                        cx.expr_path(test_type_path("UnitTest"))
+                                    }
+                                    // test::TestType::IntegrationTest
+                                    TestType::IntegrationTest => {
+                                        cx.expr_path(test_type_path("IntegrationTest"))
+                                    }
+                                    // test::TestPath::Unknown
+                                    TestType::Unknown => {
+                                        cx.expr_path(test_type_path("Unknown"))
+                                    }
+                                },),
+                                // },
+                            ],),
                         ),
                         // testfn: test::StaticTestFn(...) | test::StaticBenchFn(...)
                         field("testfn", test_fn), // }
-                    ],
-                        ), // }
-                    ),
-                }
-                .into(),
-            ),
-        );
+                    ]), // }
+                ),
+            }
+            .into(),
+        ),
+    );
     test_const = test_const.map(|mut tc| {
         tc.vis.kind = ast::VisibilityKind::Public;
         tc
diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs
index 400557ca260..95348453308 100644
--- a/compiler/rustc_builtin_macros/src/test_harness.rs
+++ b/compiler/rustc_builtin_macros/src/test_harness.rs
@@ -6,21 +6,21 @@ use rustc_ast as ast;
 use rustc_ast::entry::EntryPointType;
 use rustc_ast::mut_visit::*;
 use rustc_ast::ptr::P;
-use rustc_ast::visit::{walk_item, Visitor};
-use rustc_ast::{attr, ModKind};
+use rustc_ast::visit::{Visitor, walk_item};
+use rustc_ast::{ModKind, attr};
 use rustc_errors::DiagCtxtHandle;
 use rustc_expand::base::{ExtCtxt, ResolverExpand};
 use rustc_expand::expand::{AstFragment, ExpansionConfig};
 use rustc_feature::Features;
 use rustc_lint_defs::BuiltinLintDiag;
-use rustc_session::lint::builtin::UNNAMEABLE_TEST_ITEMS;
 use rustc_session::Session;
+use rustc_session::lint::builtin::UNNAMEABLE_TEST_ITEMS;
 use rustc_span::hygiene::{AstPass, SyntaxContext, Transparency};
-use rustc_span::symbol::{sym, Ident, Symbol};
-use rustc_span::{Span, DUMMY_SP};
+use rustc_span::symbol::{Ident, Symbol, sym};
+use rustc_span::{DUMMY_SP, Span};
 use rustc_target::spec::PanicStrategy;
-use smallvec::{smallvec, SmallVec};
-use thin_vec::{thin_vec, ThinVec};
+use smallvec::{SmallVec, smallvec};
+use thin_vec::{ThinVec, thin_vec};
 use tracing::debug;
 
 use crate::errors;
diff --git a/compiler/rustc_builtin_macros/src/trace_macros.rs b/compiler/rustc_builtin_macros/src/trace_macros.rs
index bd9ebc355e1..e624d1da66b 100644
--- a/compiler/rustc_builtin_macros/src/trace_macros.rs
+++ b/compiler/rustc_builtin_macros/src/trace_macros.rs
@@ -1,7 +1,7 @@
 use rustc_ast::tokenstream::{TokenStream, TokenTree};
 use rustc_expand::base::{DummyResult, ExpandResult, ExtCtxt, MacroExpanderResult};
-use rustc_span::symbol::kw;
 use rustc_span::Span;
+use rustc_span::symbol::kw;
 
 use crate::errors;
 
diff --git a/compiler/rustc_builtin_macros/src/util.rs b/compiler/rustc_builtin_macros/src/util.rs
index 0bcd5aef28b..d7b03a43ecb 100644
--- a/compiler/rustc_builtin_macros/src/util.rs
+++ b/compiler/rustc_builtin_macros/src/util.rs
@@ -1,12 +1,12 @@
 use rustc_ast::ptr::P;
 use rustc_ast::tokenstream::TokenStream;
-use rustc_ast::{self as ast, attr, token, AttrStyle, Attribute, MetaItem};
+use rustc_ast::{self as ast, AttrStyle, Attribute, MetaItem, attr, token};
 use rustc_errors::{Applicability, Diag, ErrorGuaranteed};
 use rustc_expand::base::{Annotatable, ExpandResult, ExtCtxt};
 use rustc_expand::expand::AstFragment;
 use rustc_feature::AttributeTemplate;
-use rustc_lint_defs::builtin::DUPLICATE_MACRO_ATTRIBUTES;
 use rustc_lint_defs::BuiltinLintDiag;
+use rustc_lint_defs::builtin::DUPLICATE_MACRO_ATTRIBUTES;
 use rustc_parse::{parser, validate_attr};
 use rustc_session::errors::report_lit_error;
 use rustc_span::{BytePos, Span, Symbol};