Reformat using the new identifier sorting from rustfmt
This commit is contained in:
parent
1173204b36
commit
c682aa162b
1455 changed files with 7152 additions and 8384 deletions
|
@ -8,7 +8,7 @@ use syn::spanned::Spanned;
|
|||
use synstructure::Structure;
|
||||
|
||||
use crate::diagnostics::diagnostic_builder::DiagnosticDeriveKind;
|
||||
use crate::diagnostics::error::{span_err, DiagnosticDeriveError};
|
||||
use crate::diagnostics::error::{DiagnosticDeriveError, span_err};
|
||||
use crate::diagnostics::utils::SetOnce;
|
||||
|
||||
/// The central struct for constructing the `into_diag` method from an annotated struct.
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
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 syn::{Attribute, Meta, Path, Token, Type, parse_quote};
|
||||
use synstructure::{BindingInfo, Structure, VariantInfo};
|
||||
|
||||
use super::utils::SubdiagnosticVariant;
|
||||
use crate::diagnostics::error::{
|
||||
span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
|
||||
DiagnosticDeriveError, span_err, throw_invalid_attr, throw_span_err,
|
||||
};
|
||||
use crate::diagnostics::utils::{
|
||||
FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind,
|
||||
build_field_mapping, is_doc_comment, report_error_if_not_applied_to_span, report_type_error,
|
||||
should_generate_arg, type_is_bool, type_is_unit, type_matches_path, FieldInfo, FieldInnerTy,
|
||||
FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind,
|
||||
should_generate_arg, type_is_bool, type_is_unit, type_matches_path,
|
||||
};
|
||||
|
||||
/// What kind of diagnostic is being derived - a fatal/error/warning or a lint?
|
||||
|
|
|
@ -8,13 +8,13 @@ use synstructure::{BindingInfo, Structure, VariantInfo};
|
|||
|
||||
use super::utils::SubdiagnosticVariant;
|
||||
use crate::diagnostics::error::{
|
||||
invalid_attr, span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
|
||||
DiagnosticDeriveError, invalid_attr, span_err, throw_invalid_attr, throw_span_err,
|
||||
};
|
||||
use crate::diagnostics::utils::{
|
||||
build_field_mapping, build_suggestion_code, is_doc_comment, new_code_ident,
|
||||
report_error_if_not_applied_to_applicability, report_error_if_not_applied_to_span,
|
||||
should_generate_arg, AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap,
|
||||
SetOnce, SpannedOption, SubdiagnosticKind,
|
||||
AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, HasFieldMap, SetOnce,
|
||||
SpannedOption, SubdiagnosticKind, build_field_mapping, build_suggestion_code, is_doc_comment,
|
||||
new_code_ident, report_error_if_not_applied_to_applicability,
|
||||
report_error_if_not_applied_to_span, should_generate_arg,
|
||||
};
|
||||
|
||||
/// The central struct for constructing the `add_to_diag` method from an annotated struct.
|
||||
|
|
|
@ -5,16 +5,16 @@ use std::str::FromStr;
|
|||
|
||||
use proc_macro::Span;
|
||||
use proc_macro2::{Ident, TokenStream};
|
||||
use quote::{format_ident, quote, ToTokens};
|
||||
use quote::{ToTokens, format_ident, quote};
|
||||
use syn::meta::ParseNestedMeta;
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{parenthesized, Attribute, Field, LitStr, Meta, Path, Token, Type, TypeTuple};
|
||||
use syn::{Attribute, Field, LitStr, Meta, Path, Token, Type, TypeTuple, parenthesized};
|
||||
use synstructure::{BindingInfo, VariantInfo};
|
||||
|
||||
use super::error::invalid_attr;
|
||||
use crate::diagnostics::error::{
|
||||
span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError,
|
||||
DiagnosticDeriveError, span_err, throw_invalid_attr, throw_span_err,
|
||||
};
|
||||
|
||||
thread_local! {
|
||||
|
|
|
@ -4,9 +4,9 @@ use syn::parse::{Parse, ParseStream};
|
|||
use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{
|
||||
braced, parse_macro_input, Attribute, Generics, ImplItem, Pat, PatIdent, Path, Signature,
|
||||
Token, TraitItem, TraitItemConst, TraitItemFn, TraitItemMacro, TraitItemType, Type, Visibility,
|
||||
WhereClause,
|
||||
Attribute, Generics, ImplItem, Pat, PatIdent, Path, Signature, Token, TraitItem,
|
||||
TraitItemConst, TraitItemFn, TraitItemMacro, TraitItemType, Type, Visibility, WhereClause,
|
||||
braced, parse_macro_input,
|
||||
};
|
||||
|
||||
pub(crate) fn extension(
|
||||
|
|
|
@ -40,14 +40,11 @@ pub(super) fn lift_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::To
|
|||
});
|
||||
|
||||
s.add_impl_generic(newtcx);
|
||||
s.bound_impl(
|
||||
quote!(::rustc_middle::ty::Lift<::rustc_middle::ty::TyCtxt<'__lifted>>),
|
||||
quote! {
|
||||
type Lifted = #lifted;
|
||||
s.bound_impl(quote!(::rustc_middle::ty::Lift<::rustc_middle::ty::TyCtxt<'__lifted>>), quote! {
|
||||
type Lifted = #lifted;
|
||||
|
||||
fn lift_to_interner(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> {
|
||||
Some(match self { #body })
|
||||
}
|
||||
},
|
||||
)
|
||||
fn lift_to_interner(self, __tcx: ::rustc_middle::ty::TyCtxt<'__lifted>) -> Option<#lifted> {
|
||||
Some(match self { #body })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ use syn::parse::{Parse, ParseStream, Result};
|
|||
use syn::punctuated::Punctuated;
|
||||
use syn::spanned::Spanned;
|
||||
use syn::{
|
||||
braced, parenthesized, parse_macro_input, parse_quote, token, AttrStyle, Attribute, Block,
|
||||
Error, Expr, Ident, Pat, ReturnType, Token, Type,
|
||||
AttrStyle, Attribute, Block, Error, Expr, Ident, Pat, ReturnType, Token, Type, braced,
|
||||
parenthesized, parse_macro_input, parse_quote, token,
|
||||
};
|
||||
|
||||
mod kw {
|
||||
|
|
|
@ -105,14 +105,11 @@ fn decodable_body(
|
|||
};
|
||||
s.underscore_const(true);
|
||||
|
||||
s.bound_impl(
|
||||
quote!(::rustc_serialize::Decodable<#decoder_ty>),
|
||||
quote! {
|
||||
fn decode(__decoder: &mut #decoder_ty) -> Self {
|
||||
#decode_body
|
||||
}
|
||||
},
|
||||
)
|
||||
s.bound_impl(quote!(::rustc_serialize::Decodable<#decoder_ty>), quote! {
|
||||
fn decode(__decoder: &mut #decoder_ty) -> Self {
|
||||
#decode_body
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fn decode_field(field: &syn::Field) -> proc_macro2::TokenStream {
|
||||
|
@ -288,16 +285,13 @@ fn encodable_body(
|
|||
quote! {}
|
||||
};
|
||||
|
||||
s.bound_impl(
|
||||
quote!(::rustc_serialize::Encodable<#encoder_ty>),
|
||||
quote! {
|
||||
fn encode(
|
||||
&self,
|
||||
__encoder: &mut #encoder_ty,
|
||||
) {
|
||||
#lints
|
||||
#encode_body
|
||||
}
|
||||
},
|
||||
)
|
||||
s.bound_impl(quote!(::rustc_serialize::Encodable<#encoder_ty>), quote! {
|
||||
fn encode(
|
||||
&self,
|
||||
__encoder: &mut #encoder_ty,
|
||||
) {
|
||||
#lints
|
||||
#encode_body
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ use proc_macro2::{Span, TokenStream};
|
|||
use quote::quote;
|
||||
use syn::parse::{Parse, ParseStream, Result};
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::{braced, Expr, Ident, Lit, LitStr, Macro, Token};
|
||||
use syn::{Expr, Ident, Lit, LitStr, Macro, Token, braced};
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
|
|
@ -94,8 +94,8 @@ fn check_symbol_order() {
|
|||
aardvark,
|
||||
}
|
||||
};
|
||||
test_symbols_macro(
|
||||
input,
|
||||
&["Symbol `aardvark` must precede `zebra`", "location of previous symbol `zebra`"],
|
||||
);
|
||||
test_symbols_macro(input, &[
|
||||
"Symbol `aardvark` must precede `zebra`",
|
||||
"location of previous symbol `zebra`",
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use quote::{quote, ToTokens};
|
||||
use quote::{ToTokens, quote};
|
||||
use syn::parse_quote;
|
||||
|
||||
pub(super) fn type_foldable_derive(mut s: synstructure::Structure<'_>) -> proc_macro2::TokenStream {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue