File tree 1 file changed +23
-14
lines changed
1 file changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,8 @@ impl Display<'_> {
397
397
sub_cfgs : & [ Cfg ] ,
398
398
separator : & str ,
399
399
) -> fmt:: Result {
400
+ use fmt:: Display as _;
401
+
400
402
let short_longhand = self . 1 . is_long ( ) && {
401
403
let all_crate_features =
402
404
sub_cfgs. iter ( ) . all ( |sub_cfg| matches ! ( sub_cfg, Cfg :: Cfg ( sym:: feature, Some ( _) ) ) ) ;
@@ -415,20 +417,27 @@ impl Display<'_> {
415
417
}
416
418
} ;
417
419
418
- for ( i, sub_cfg) in sub_cfgs. iter ( ) . enumerate ( ) {
419
- if i != 0 {
420
- fmt. write_str ( separator) ?;
421
- }
422
- if let ( true , Cfg :: Cfg ( _, Some ( feat) ) ) = ( short_longhand, sub_cfg) {
423
- if self . 1 . is_html ( ) {
424
- write ! ( fmt, "<code>{feat}</code>" ) ?;
425
- } else {
426
- write ! ( fmt, "`{feat}`" ) ?;
427
- }
428
- } else {
429
- write_with_opt_paren ( fmt, !sub_cfg. is_all ( ) , Display ( sub_cfg, self . 1 ) ) ?;
430
- }
431
- }
420
+ ( || {
421
+ sub_cfgs. iter ( ) . map ( |sub_cfg| {
422
+ fmt:: from_fn ( move |fmt| {
423
+ if let Cfg :: Cfg ( _, Some ( feat) ) = sub_cfg
424
+ && short_longhand
425
+ {
426
+ if self . 1 . is_html ( ) {
427
+ write ! ( fmt, "<code>{feat}</code>" ) ?;
428
+ } else {
429
+ write ! ( fmt, "`{feat}`" ) ?;
430
+ }
431
+ } else {
432
+ write_with_opt_paren ( fmt, !sub_cfg. is_all ( ) , Display ( sub_cfg, self . 1 ) ) ?;
433
+ }
434
+ Ok ( ( ) )
435
+ } )
436
+ } )
437
+ } )
438
+ . join ( separator)
439
+ . fmt ( fmt) ?;
440
+
432
441
Ok ( ( ) )
433
442
}
434
443
}
You can’t perform that action at this time.
0 commit comments