Skip to content
Myr

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

5 files+27 added−13 removed

modified:serde_derive/src/internals/attr.rs+1 added-3 removed
946 unmodified lines
947 }948949 // 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 lines
modified:serde_derive/src/internals/check.rs+4 added-2 removed
308 unmodified lines
309310 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 lines
327 }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}334335fn member_message(member: &Member) -> String {
20 unmodified lines
modified:serde_derive/src/bound.rs+7 added-2 removed
155 unmodified lines
156 // }157 fn visit_macro(&mut self, _mac: &'ast syn::Macro) {}158 }159160 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();164165 let mut visitor = FindTyParams {166 all_type_params: all_type_params,167 relevant_type_params: HashSet::new(),
94 unmodified lines
262 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 param
47 unmodified lines
modified:serde_derive/src/de.rs+14 added-5 removed
787 unmodified lines
788 _serde::export::Ok(())789 }790}791792fn deserialize_newtype_struct(type_path: &TokenStream, params: &Parameters, field: &Field) -> TokenStream {792fn 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;799800 let value = match field.attrs.deserialize_with() {
1129 unmodified lines
1930 };19311932 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();19411942 let names = names_idents.iter().map(|&(ref name, _)| name);1943
892 unmodified lines
2836 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 lines
modified:serde_derive/src/fragment.rs+1 added-1 removed
4 unmodified lines
5// <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.89use proc_macro2::TokenStream;10use quote::ToTokens;11use syn::token;11use proc_macro2::TokenStream;1213pub enum Fragment {14 /// Tokens that can be used as an expression.15 Expr(TokenStream),
67 unmodified lines