We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 508ece8 commit f3fbd99Copy full SHA for f3fbd99
impl/src/attr.rs
@@ -230,7 +230,18 @@ impl ToTokens for Display<'_> {
230
231
impl ToTokens for Trait {
232
fn to_tokens(&self, tokens: &mut TokenStream) {
233
- let trait_name = format_ident!("{}", format!("{:?}", self));
234
- tokens.extend(quote!(::core::fmt::#trait_name));
+ let trait_name = match self {
+ Trait::Debug => "Debug",
235
+ Trait::Display => "Display",
236
+ Trait::Octal => "Octal",
237
+ Trait::LowerHex => "LowerHex",
238
+ Trait::UpperHex => "UpperHex",
239
+ Trait::Pointer => "Pointer",
240
+ Trait::Binary => "Binary",
241
+ Trait::LowerExp => "LowerExp",
242
+ Trait::UpperExp => "UpperExp",
243
+ };
244
+ let ident = Ident::new(trait_name, Span::call_site());
245
+ tokens.extend(quote!(::core::fmt::#ident));
246
}
247
0 commit comments