Trim the r# from raw identifiers in user-facing strings

This commit is contained in:
David Tolnay
2018-08-22 20:50:29 -04:00
parent c69a3e083f
commit dc4bb0bf08
3 changed files with 13 additions and 7 deletions
+2 -1
View File
@@ -26,7 +26,8 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<TokenStream,
let ident = &cont.ident;
let params = Parameters::new(&cont);
let (impl_generics, ty_generics, where_clause) = params.generics.split_for_impl();
let dummy_const = Ident::new(&format!("_IMPL_SERIALIZE_FOR_{}", ident), Span::call_site());
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 body = Stmts(serialize_body(&cont, &params));
let impl_block = if let Some(remote) = cont.attrs.remote() {