Format with rustfmt 0.7.0
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Tolnay · committed by David Tolnay · parent ad62a68 · Browse files · 5 files·+27 added−13 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+27 added−13 removed
- other:+27 added−13 removed
Provenance
- Commit
06dcbbb- Tree
305072b- Author
David Tolnay <dtolnay@gmail.com>- Committer
David Tolnay <dtolnay@gmail.com>- Parent
ad62a68
5 files changed+27 added−13 removed
modified:serde_derive/src/internals/attr.rs+1 added-3 removed
946 unmodified lines947 }948 949 // Parse `#[serde(borrow = "'a + 'b")]`950 Meta(NameValue(ref m)) if m.ident == "borrow" => {951- if let Ok(lifetimes) =952- parse_lit_into_lifetimes(cx, &m.ident, &m.lit)953- {951+ if let Ok(lifetimes) = parse_lit_into_lifetimes(cx, &m.ident, &m.lit) {952 if let Ok(borrowable) = borrowable_lifetimes(cx, &ident, &field.ty) {953 for lifetime in &lifetimes {954 if !borrowable.contains(lifetime) {955 cx.error(format!(605 unmodified linesmodified:serde_derive/src/internals/check.rs+4 added-2 removed
308 unmodified lines309 310 for field in fields {311 if allow_transparent(field, derive) {312 if transparent_field.is_some() {313- cx.error("#[serde(transparent)] requires struct to have at most one transparent field");313+ cx.error(314+ "#[serde(transparent)] requires struct to have at most one transparent field",315+ );316 return;317 }318 transparent_field = Some(field);319 }7 unmodified lines327 }328 Derive::Deserialize => {329 cx.error("#[serde(transparent)] requires at least one field that is neither skipped nor has a default");330 }329- }331+ },332 }333 }334 335 fn member_message(member: &Member) -> String {20 unmodified linesmodified:serde_derive/src/bound.rs+7 added-2 removed
155 unmodified lines156 // }157 fn visit_macro(&mut self, _mac: &'ast syn::Macro) {}158 }159 160- let all_type_params = generics.type_params().map(|param| param.ident.clone()).collect();160+ let all_type_params = generics161+ .type_params()162+ .map(|param| param.ident.clone())163+ .collect();164 165 let mut visitor = FindTyParams {166 all_type_params: all_type_params,167 relevant_type_params: HashSet::new(),94 unmodified lines262 syn::GenericParam::Lifetime(ref mut param) => {263 param.bounds.push(bound.clone());264 }265 syn::GenericParam::Type(ref mut param) => {266+ param267+ .bounds263- param.bounds.push(syn::TypeParamBound::Lifetime(bound.clone()));268+ .push(syn::TypeParamBound::Lifetime(bound.clone()));269 }270 syn::GenericParam::Const(_) => {}271 }272 param47 unmodified linesmodified:serde_derive/src/de.rs+14 added-5 removed
787 unmodified lines788 _serde::export::Ok(())789 }790 }791 792-fn deserialize_newtype_struct(type_path: &TokenStream, params: &Parameters, field: &Field) -> TokenStream {792+fn deserialize_newtype_struct(793+ type_path: &TokenStream,794+ params: &Parameters,795+ field: &Field,796+) -> TokenStream {797 let delife = params.borrowed.de_lifetime();798 let field_ty = field.ty;799 800 let value = match field.attrs.deserialize_with() {1129 unmodified lines1930 };1931 1932 let names_idents: Vec<_> = ordinary1933 .iter()1930- .map(|variant| (variant.attrs.name().deserialize_name(), variant.ident.clone()))1934+ .map(|variant| {1935+ (1936+ variant.attrs.name().deserialize_name(),1937+ variant.ident.clone(),1938+ )1939+ })1940 .collect();1941 1942 let names = names_idents.iter().map(|&(ref name, _)| name);1943 892 unmodified lines2836 syn::GenericParam::Lifetime(ref mut param) => {2837 param.bounds.push(place_lifetime.lifetime.clone());2838 }2839 syn::GenericParam::Type(ref mut param) => {2831- param2832- .bounds2833- .push(syn::TypeParamBound::Lifetime(place_lifetime.lifetime.clone()));2840+ param.bounds.push(syn::TypeParamBound::Lifetime(2841+ place_lifetime.lifetime.clone(),2842+ ));2843 }2844 syn::GenericParam::Const(_) => {}2845 }2846 }102 unmodified linesmodified:serde_derive/src/fragment.rs+1 added-1 removed
4 unmodified lines5 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your6 // option. This file may not be copied, modified, or distributed7 // except according to those terms.8 9+use proc_macro2::TokenStream;10 use quote::ToTokens;11 use syn::token;11-use proc_macro2::TokenStream;12 13 pub enum Fragment {14 /// Tokens that can be used as an expression.15 Expr(TokenStream),67 unmodified lines