Format with rustfmt 0.99.2

This commit is contained in:
David Tolnay 2018-09-01 23:03:41 -07:00
parent 55cecace29
commit d23a40c1bb
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 10 additions and 5 deletions

View File

@ -27,7 +27,10 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<TokenStream,
let params = Parameters::new(&cont);
let (impl_generics, ty_generics, where_clause) = params.generics.split_for_impl();
let suffix = ident.to_string().trim_left_matches("r#").to_owned();
let dummy_const = Ident::new(&format!("_IMPL_SERIALIZE_FOR_{}", suffix), Span::call_site());
let dummy_const = Ident::new(
&format!("_IMPL_SERIALIZE_FOR_{}", suffix),
Span::call_site(),
);
let body = Stmts(serialize_body(&cont, &params));
let impl_block = if let Some(remote) = cont.attrs.remote() {

View File

@ -13,15 +13,17 @@ fn test_raw_identifiers() {
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
enum r#type {
r#type {
r#type: (),
}
r#type { r#type: () },
}
assert_tokens(
&r#type::r#type { r#type: () },
&[
Token::StructVariant { name: "type", variant: "type", len: 1 },
Token::StructVariant {
name: "type",
variant: "type",
len: 1,
},
Token::Str("type"),
Token::Unit,
Token::StructVariantEnd,