File tree Expand file tree Collapse file tree 1 file changed +2
-18
lines changed Expand file tree Collapse file tree 1 file changed +2
-18
lines changed Original file line number Diff line number Diff line change @@ -312,17 +312,15 @@ impl Attrs {
312
312
https://docs.rs/structopt/0.3.5/structopt/#magical-methods")
313
313
} ;
314
314
315
- let static_name = format_ident ! ( "__STRUCTOPT_DEFAULT_VALUE_{}" , fresh_id( ) ) ;
316
-
317
315
quote_spanned ! ( ident. span( ) => {
318
316
:: structopt:: lazy_static:: lazy_static! {
319
- static ref #static_name : & ' static str = {
317
+ static ref DEFAULT_VALUE : & ' static str = {
320
318
let val = <#ty as :: std:: default :: Default >:: default ( ) ;
321
319
let s = :: std:: string:: ToString :: to_string( & val) ;
322
320
:: std:: boxed:: Box :: leak( s. into_boxed_str( ) )
323
321
} ;
324
322
}
325
- * #static_name
323
+ * DEFAULT_VALUE
326
324
} )
327
325
} ;
328
326
@@ -642,20 +640,6 @@ impl Attrs {
642
640
}
643
641
}
644
642
645
- fn fresh_id ( ) -> usize {
646
- use std:: cell:: Cell ;
647
-
648
- thread_local ! {
649
- static NEXT_ID : Cell <usize > = Cell :: new( 0 ) ;
650
- }
651
-
652
- NEXT_ID . with ( |next_id| {
653
- let id = next_id. get ( ) ;
654
- next_id. set ( id + 1 ) ;
655
- id
656
- } )
657
- }
658
-
659
643
/// replace all `:` with `, ` when not inside the `<>`
660
644
///
661
645
/// `"author1:author2:author3" => "author1, author2, author3"`
You can’t perform that action at this time.
0 commit comments