@@ -663,8 +663,7 @@ impl<'db> DiagnosticEntry<'db> for SemanticDiagnostic<'db> {
663663 "Ambiguous path. Multiple matching items: {}" ,
664664 module_items
665665 . iter( )
666- . map( |item| format!( "`{}`" , item. full_path( db) ) )
667- . format( ", " )
666+ . format_with( ", " , |item, f| f( & format_args!( "`{}`" , item. full_path( db) ) ) )
668667 )
669668 }
670669 SemanticDiagnosticKind :: UseSelfNonMulti => {
@@ -718,10 +717,9 @@ impl<'db> DiagnosticEntry<'db> for SemanticDiagnostic<'db> {
718717 } else {
719718 format!(
720719 " through any of the modules: {}" ,
721- containing_modules
722- . iter( )
723- . map( |module_id| format!( "`{}`" , module_id. full_path( db) ) )
724- . format( ", " )
720+ containing_modules. iter( ) . format_with( ", " , |module_id, f| {
721+ f( & format_args!( "`{}`" , module_id. full_path( db) ) )
722+ } )
725723 )
726724 }
727725 )
@@ -779,7 +777,9 @@ impl<'db> DiagnosticEntry<'db> for SemanticDiagnostic<'db> {
779777 SemanticDiagnosticKind :: MissingItemsInImpl ( item_names) => {
780778 format ! (
781779 "Not all trait items are implemented. Missing: {}." ,
782- item_names. iter( ) . map( |name| format!( "'{}'" , name. long( db) ) ) . format( ", " )
780+ item_names
781+ . iter( )
782+ . format_with( ", " , |name, f| f( & format_args!( "'{}'" , name. long( db) ) ) )
783783 )
784784 }
785785 SemanticDiagnosticKind :: PassPanicAsNopanic { impl_function_id, trait_id } => {
@@ -918,15 +918,13 @@ impl<'db> DiagnosticEntry<'db> for SemanticDiagnostic<'db> {
918918 if !relevant_traits. is_empty ( ) {
919919 let suggestions = relevant_traits
920920 . iter ( )
921- . map ( |trait_path| format ! ( "`{trait_path}`" ) )
922- . format ( ", " ) ;
921+ . format_with ( ", " , |trait_path, f| f ( & format_args ! ( "`{trait_path}`" ) ) ) ;
923922
924923 format ! (
925924 "Method `{}` not found on type `{}`. Consider importing one of the \
926- following traits: {}.",
925+ following traits: {suggestions }.",
927926 method_name. long( db) ,
928927 ty. format( db) ,
929- suggestions
930928 )
931929 } else {
932930 format ! (
0 commit comments