diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:13:50 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-07-29 08:26:52 +1000 |
| commit | 84ac80f1921afc243d71fd0caaa4f2838c294102 (patch) | |
| tree | 29006db815bf547dfd0129910b23b8c54675bd98 /compiler/rustc_macros/src | |
| parent | 118f9350c5b902e462a6dcc4325670f3da701600 (diff) | |
| download | rust-84ac80f1921afc243d71fd0caaa4f2838c294102.tar.gz rust-84ac80f1921afc243d71fd0caaa4f2838c294102.zip | |
Reformat `use` declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
Diffstat (limited to 'compiler/rustc_macros/src')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/diagnostic.rs | 7 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs | 14 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/error.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/subdiagnostic.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/utils.rs | 17 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/lib.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/symbols.rs | 6 |
7 files changed, 34 insertions, 29 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic.rs b/compiler/rustc_macros/src/diagnostics/diagnostic.rs index 2743660ab89..52d892a20f4 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic.rs @@ -2,14 +2,15 @@ use std::cell::RefCell; -use crate::diagnostics::diagnostic_builder::DiagnosticDeriveKind; -use crate::diagnostics::error::{span_err, DiagnosticDeriveError}; -use crate::diagnostics::utils::SetOnce; use proc_macro2::TokenStream; use quote::quote; use syn::spanned::Spanned; use synstructure::Structure; +use crate::diagnostics::diagnostic_builder::DiagnosticDeriveKind; +use crate::diagnostics::error::{span_err, DiagnosticDeriveError}; +use crate::diagnostics::utils::SetOnce; + /// The central struct for constructing the `into_diag` method from an annotated struct. pub(crate) struct DiagnosticDerive<'a> { structure: Structure<'a>, diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs index f93d89d6c0f..5c2a429a1eb 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs @@ -1,5 +1,12 @@ #![deny(unused_must_use)] +use proc_macro2::{Ident, Span, TokenStream}; +use quote::{format_ident, quote, quote_spanned}; +use syn::spanned::Spanned; +use syn::{parse_quote, Attribute, Meta, Path, Token, Type}; +use synstructure::{BindingInfo, Structure, VariantInfo}; + +use super::utils::SubdiagnosticVariant; use crate::diagnostics::error::{ span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError, }; @@ -8,13 +15,6 @@ use crate::diagnostics::utils::{ should_generate_arg, type_is_bool, type_is_unit, type_matches_path, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind, }; -use proc_macro2::{Ident, Span, TokenStream}; -use quote::{format_ident, quote, quote_spanned}; -use syn::Token; -use syn::{parse_quote, spanned::Spanned, Attribute, Meta, Path, Type}; -use synstructure::{BindingInfo, Structure, VariantInfo}; - -use super::utils::SubdiagnosticVariant; /// What kind of diagnostic is being derived - a fatal/error/warning or a lint? #[derive(Clone, Copy, PartialEq, Eq)] diff --git a/compiler/rustc_macros/src/diagnostics/error.rs b/compiler/rustc_macros/src/diagnostics/error.rs index 13138ee4ab7..9cdb9fbab12 100644 --- a/compiler/rustc_macros/src/diagnostics/error.rs +++ b/compiler/rustc_macros/src/diagnostics/error.rs @@ -1,7 +1,8 @@ use proc_macro::{Diagnostic, Level, MultiSpan}; use proc_macro2::TokenStream; use quote::quote; -use syn::{spanned::Spanned, Attribute, Error as SynError, Meta}; +use syn::spanned::Spanned; +use syn::{Attribute, Error as SynError, Meta}; #[derive(Debug)] pub(crate) enum DiagnosticDeriveError { diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index 7f090f5ebc1..5d5d279eaf0 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -1,5 +1,12 @@ #![deny(unused_must_use)] +use proc_macro2::TokenStream; +use quote::{format_ident, quote}; +use syn::spanned::Spanned; +use syn::{Attribute, Meta, MetaList, Path}; +use synstructure::{BindingInfo, Structure, VariantInfo}; + +use super::utils::SubdiagnosticVariant; use crate::diagnostics::error::{ invalid_attr, span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError, }; @@ -9,12 +16,6 @@ use crate::diagnostics::utils::{ should_generate_arg, AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind, }; -use proc_macro2::TokenStream; -use quote::{format_ident, quote}; -use syn::{spanned::Spanned, Attribute, Meta, MetaList, Path}; -use synstructure::{BindingInfo, Structure, VariantInfo}; - -use super::utils::SubdiagnosticVariant; /// The central struct for constructing the `add_to_diag` method from an annotated struct. pub(crate) struct SubdiagnosticDerive { diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs index 05a5a32514b..0d3b2f52fa2 100644 --- a/compiler/rustc_macros/src/diagnostics/utils.rs +++ b/compiler/rustc_macros/src/diagnostics/utils.rs @@ -1,20 +1,21 @@ -use crate::diagnostics::error::{ - span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError, -}; -use proc_macro::Span; -use proc_macro2::{Ident, TokenStream}; -use quote::{format_ident, quote, ToTokens}; use std::cell::RefCell; use std::collections::{BTreeSet, HashMap}; use std::fmt; use std::str::FromStr; + +use proc_macro::Span; +use proc_macro2::{Ident, TokenStream}; +use quote::{format_ident, quote, ToTokens}; use syn::meta::ParseNestedMeta; use syn::punctuated::Punctuated; -use syn::{parenthesized, LitStr, Path, Token}; -use syn::{spanned::Spanned, Attribute, Field, Meta, Type, TypeTuple}; +use syn::spanned::Spanned; +use syn::{parenthesized, Attribute, Field, LitStr, Meta, Path, Token, Type, TypeTuple}; use synstructure::{BindingInfo, VariantInfo}; use super::error::invalid_attr; +use crate::diagnostics::error::{ + span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError, +}; thread_local! { pub(crate) static CODE_IDENT_COUNT: RefCell<u32> = RefCell::new(0); diff --git a/compiler/rustc_macros/src/lib.rs b/compiler/rustc_macros/src/lib.rs index 9d7418cd370..c59f86b0a9b 100644 --- a/compiler/rustc_macros/src/lib.rs +++ b/compiler/rustc_macros/src/lib.rs @@ -10,9 +10,8 @@ #![feature(proc_macro_tracked_env)] // tidy-alphabetical-end -use synstructure::decl_derive; - use proc_macro::TokenStream; +use synstructure::decl_derive; mod current_version; mod diagnostics; diff --git a/compiler/rustc_macros/src/symbols.rs b/compiler/rustc_macros/src/symbols.rs index 488d4504a2d..6074c93d59c 100644 --- a/compiler/rustc_macros/src/symbols.rs +++ b/compiler/rustc_macros/src/symbols.rs @@ -24,11 +24,13 @@ //! CFG_RELEASE="0.0.0" cargo +nightly expand > /tmp/rustc_span.rs //! ``` +use std::collections::HashMap; + use proc_macro2::{Span, TokenStream}; use quote::quote; -use std::collections::HashMap; use syn::parse::{Parse, ParseStream, Result}; -use syn::{braced, punctuated::Punctuated, Expr, Ident, Lit, LitStr, Macro, Token}; +use syn::punctuated::Punctuated; +use syn::{braced, Expr, Ident, Lit, LitStr, Macro, Token}; #[cfg(test)] mod tests; |
