@@ -505,27 +505,15 @@ impl Envelope {
505505 . unwrap_or_default ( )
506506 . to_string ( )
507507 } else {
508- self . bcc . iter ( ) . fold ( String :: new ( ) , |mut acc, x| {
509- if !acc. is_empty ( ) {
510- acc. push_str ( ", " ) ;
511- }
512- acc. push_str ( & x. to_string ( ) ) ;
513- acc
514- } )
508+ Address :: display_slice ( self . bcc ( ) , None )
515509 }
516510 }
517511
518512 pub fn field_cc_to_string ( & self ) -> String {
519513 if self . cc . is_empty ( ) {
520514 self . other_headers . get ( "Cc" ) . unwrap_or_default ( ) . to_string ( )
521515 } else {
522- self . cc . iter ( ) . fold ( String :: new ( ) , |mut acc, x| {
523- if !acc. is_empty ( ) {
524- acc. push_str ( ", " ) ;
525- }
526- acc. push_str ( & x. to_string ( ) ) ;
527- acc
528- } )
516+ Address :: display_slice ( self . cc ( ) , None )
529517 }
530518 }
531519
@@ -536,13 +524,7 @@ impl Envelope {
536524 . unwrap_or_default ( )
537525 . to_string ( )
538526 } else {
539- self . from . iter ( ) . fold ( String :: new ( ) , |mut acc, x| {
540- if !acc. is_empty ( ) {
541- acc. push_str ( ", " ) ;
542- }
543- acc. push_str ( & x. to_string ( ) ) ;
544- acc
545- } )
527+ Address :: display_slice ( self . from ( ) , None )
546528 }
547529 }
548530
@@ -562,16 +544,7 @@ impl Envelope {
562544 if self . to . is_empty ( ) {
563545 self . other_headers . get ( "To" ) . unwrap_or_default ( ) . to_string ( )
564546 } else {
565- self . to
566- . iter ( )
567- . map ( |a| format ! ( "{}" , a) )
568- . fold ( String :: new ( ) , |mut acc, x| {
569- if !acc. is_empty ( ) {
570- acc. push_str ( ", " ) ;
571- }
572- acc. push_str ( & x) ;
573- acc
574- } )
547+ Address :: display_slice ( self . to ( ) , None )
575548 }
576549 }
577550
@@ -583,15 +556,7 @@ impl Envelope {
583556 . unwrap_or_default ( )
584557 . to_string ( )
585558 } else {
586- refs. iter ( )
587- . map ( |a| a. to_string ( ) )
588- . fold ( String :: new ( ) , |mut acc, x| {
589- if !acc. is_empty ( ) {
590- acc. push_str ( ", " ) ;
591- }
592- acc. push_str ( & x) ;
593- acc
594- } )
559+ MessageID :: display_slice ( refs, Some ( "\n " ) )
595560 }
596561 }
597562
0 commit comments