Format with rustfmt 0.7.0
This commit is contained in:
parent
ad62a6895c
commit
06dcbbbaba
@ -157,7 +157,10 @@ pub fn with_bound(
|
||||
fn visit_macro(&mut self, _mac: &'ast syn::Macro) {}
|
||||
}
|
||||
|
||||
let all_type_params = generics.type_params().map(|param| param.ident.clone()).collect();
|
||||
let all_type_params = generics
|
||||
.type_params()
|
||||
.map(|param| param.ident.clone())
|
||||
.collect();
|
||||
|
||||
let mut visitor = FindTyParams {
|
||||
all_type_params: all_type_params,
|
||||
@ -260,7 +263,9 @@ pub fn with_lifetime_bound(generics: &syn::Generics, lifetime: &str) -> syn::Gen
|
||||
param.bounds.push(bound.clone());
|
||||
}
|
||||
syn::GenericParam::Type(ref mut param) => {
|
||||
param.bounds.push(syn::TypeParamBound::Lifetime(bound.clone()));
|
||||
param
|
||||
.bounds
|
||||
.push(syn::TypeParamBound::Lifetime(bound.clone()));
|
||||
}
|
||||
syn::GenericParam::Const(_) => {}
|
||||
}
|
||||
|
@ -789,7 +789,11 @@ fn deserialize_seq_in_place(
|
||||
}
|
||||
}
|
||||
|
||||
fn deserialize_newtype_struct(type_path: &TokenStream, params: &Parameters, field: &Field) -> TokenStream {
|
||||
fn deserialize_newtype_struct(
|
||||
type_path: &TokenStream,
|
||||
params: &Parameters,
|
||||
field: &Field,
|
||||
) -> TokenStream {
|
||||
let delife = params.borrowed.de_lifetime();
|
||||
let field_ty = field.ty;
|
||||
|
||||
@ -1927,7 +1931,12 @@ fn deserialize_custom_identifier(
|
||||
|
||||
let names_idents: Vec<_> = ordinary
|
||||
.iter()
|
||||
.map(|variant| (variant.attrs.name().deserialize_name(), variant.ident.clone()))
|
||||
.map(|variant| {
|
||||
(
|
||||
variant.attrs.name().deserialize_name(),
|
||||
variant.ident.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let names = names_idents.iter().map(|&(ref name, _)| name);
|
||||
@ -2828,9 +2837,9 @@ impl<'a> ToTokens for InPlaceImplGenerics<'a> {
|
||||
param.bounds.push(place_lifetime.lifetime.clone());
|
||||
}
|
||||
syn::GenericParam::Type(ref mut param) => {
|
||||
param
|
||||
.bounds
|
||||
.push(syn::TypeParamBound::Lifetime(place_lifetime.lifetime.clone()));
|
||||
param.bounds.push(syn::TypeParamBound::Lifetime(
|
||||
place_lifetime.lifetime.clone(),
|
||||
));
|
||||
}
|
||||
syn::GenericParam::Const(_) => {}
|
||||
}
|
||||
|
@ -6,9 +6,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use proc_macro2::TokenStream;
|
||||
use quote::ToTokens;
|
||||
use syn::token;
|
||||
use proc_macro2::TokenStream;
|
||||
|
||||
pub enum Fragment {
|
||||
/// Tokens that can be used as an expression.
|
||||
|
@ -948,9 +948,7 @@ impl Field {
|
||||
|
||||
// Parse `#[serde(borrow = "'a + 'b")]`
|
||||
Meta(NameValue(ref m)) if m.ident == "borrow" => {
|
||||
if let Ok(lifetimes) =
|
||||
parse_lit_into_lifetimes(cx, &m.ident, &m.lit)
|
||||
{
|
||||
if let Ok(lifetimes) = parse_lit_into_lifetimes(cx, &m.ident, &m.lit) {
|
||||
if let Ok(borrowable) = borrowable_lifetimes(cx, &ident, &field.ty) {
|
||||
for lifetime in &lifetimes {
|
||||
if !borrowable.contains(lifetime) {
|
||||
|
@ -310,7 +310,9 @@ fn check_transparent(cx: &Ctxt, cont: &mut Container, derive: Derive) {
|
||||
for field in fields {
|
||||
if allow_transparent(field, derive) {
|
||||
if transparent_field.is_some() {
|
||||
cx.error("#[serde(transparent)] requires struct to have at most one transparent field");
|
||||
cx.error(
|
||||
"#[serde(transparent)] requires struct to have at most one transparent field",
|
||||
);
|
||||
return;
|
||||
}
|
||||
transparent_field = Some(field);
|
||||
@ -326,7 +328,7 @@ fn check_transparent(cx: &Ctxt, cont: &mut Container, derive: Derive) {
|
||||
Derive::Deserialize => {
|
||||
cx.error("#[serde(transparent)] requires at least one field that is neither skipped nor has a default");
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user