This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-14
lines changed Expand file tree Collapse file tree 1 file changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -397,6 +397,8 @@ impl Display<'_> {
397397 sub_cfgs : & [ Cfg ] ,
398398 separator : & str ,
399399 ) -> fmt:: Result {
400+ use fmt:: Display as _;
401+
400402 let short_longhand = self . 1 . is_long ( ) && {
401403 let all_crate_features =
402404 sub_cfgs. iter ( ) . all ( |sub_cfg| matches ! ( sub_cfg, Cfg :: Cfg ( sym:: feature, Some ( _) ) ) ) ;
@@ -415,20 +417,27 @@ impl Display<'_> {
415417 }
416418 } ;
417419
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+
432441 Ok ( ( ) )
433442 }
434443}
You can’t perform that action at this time.
0 commit comments