File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,18 @@ impl ToTokens for Display<'_> {
230230
231231impl ToTokens for Trait {
232232 fn to_tokens ( & self , tokens : & mut TokenStream ) {
233- let trait_name = format_ident ! ( "{}" , format!( "{:?}" , self ) ) ;
234- tokens. extend ( quote ! ( :: core:: fmt:: #trait_name) ) ;
233+ let trait_name = match self {
234+ 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) ) ;
235246 }
236247}
You can’t perform that action at this time.
0 commit comments