@@ -959,7 +959,8 @@ fn flatten_group_to_plain_string(
959959 let repeated_indent_str = help_options. indention_prefix . repeat ( nest_level) ;
960960
961961 if nest_level > 0 {
962- write ! ( group_text, "\n {repeated_indent_str}**{}**" , group. name) . unwrap ( ) ;
962+ write ! ( group_text, "\n {repeated_indent_str}**{}**" , group. name)
963+ . expect ( "writing to a string should never fail" ) ;
963964 }
964965
965966 if group. prefixes . is_empty ( ) {
@@ -970,7 +971,7 @@ fn flatten_group_to_plain_string(
970971 " ({}: `{}`): " ,
971972 help_options. group_prefix,
972973 group. prefixes. join( "`, `" ) ,
973- ) . unwrap ( ) ;
974+ ) . expect ( "writing to a string should never fail" ) ;
974975 }
975976
976977 let joined_commands = group. command_names . join ( ", " ) ;
@@ -1232,7 +1233,7 @@ fn grouped_commands_to_plain_string(
12321233 result. push ( '\n' ) ;
12331234
12341235 for group in groups {
1235- write ! ( result, "\n **{}**" , & group. name) . unwrap ( ) ;
1236+ write ! ( result, "\n **{}**" , & group. name) . expect ( "writing to a string should never fail" ) ;
12361237
12371238 flatten_group_to_plain_string ( & mut result, group, 0 , help_options) ;
12381239 }
@@ -1245,15 +1246,16 @@ fn grouped_commands_to_plain_string(
12451246fn single_command_to_plain_string ( help_options : & HelpOptions , command : & Command < ' _ > ) -> String {
12461247 let mut result = String :: new ( ) ;
12471248
1248- writeln ! ( result, "__**{}**__" , command. name) . unwrap ( ) ;
1249+ writeln ! ( result, "__**{}**__" , command. name) . expect ( "writing to a string should never fail" ) ;
12491250
12501251 if !command. aliases . is_empty ( ) {
12511252 write ! ( result, "**{}**: `{}`" , help_options. aliases_label, command. aliases. join( "`, `" ) )
1252- . unwrap ( ) ;
1253+ . expect ( "writing to a string should never fail" ) ;
12531254 }
12541255
12551256 if let Some ( description) = command. description {
1256- writeln ! ( result, "**{}**: {description}" , help_options. description_label) . unwrap ( ) ;
1257+ writeln ! ( result, "**{}**: {description}" , help_options. description_label)
1258+ . expect ( "writing to a string should never fail" ) ;
12571259 }
12581260
12591261 if let Some ( usage) = command. usage {
@@ -1263,10 +1265,10 @@ fn single_command_to_plain_string(help_options: &HelpOptions, command: &Command<
12631265 "**{}**: `{first_prefix} {} {usage}`" ,
12641266 help_options. usage_label, command. name
12651267 )
1266- . unwrap ( ) ;
1268+ . expect ( "writing to a string should never fail" ) ;
12671269 } else {
12681270 writeln ! ( result, "**{}**: `{} {usage}`" , help_options. usage_label, command. name)
1269- . unwrap ( ) ;
1271+ . expect ( "writing to a string should never fail" ) ;
12701272 }
12711273 }
12721274
@@ -1278,7 +1280,7 @@ fn single_command_to_plain_string(help_options: &HelpOptions, command: &Command<
12781280 "**{}**: `{first_prefix} {} {example}`" ,
12791281 help_options. usage_sample_label, command. name
12801282 )
1281- . unwrap ( ) ;
1283+ . expect ( "writing to a string should never fail" ) ;
12821284 } ;
12831285 command. usage_sample . iter ( ) . for_each ( format_example) ;
12841286 } else {
@@ -1288,16 +1290,18 @@ fn single_command_to_plain_string(help_options: &HelpOptions, command: &Command<
12881290 "**{}**: `{} {example}`" ,
12891291 help_options. usage_sample_label, command. name
12901292 )
1291- . unwrap ( ) ;
1293+ . expect ( "writing to a string should never fail" ) ;
12921294 } ;
12931295 command. usage_sample . iter ( ) . for_each ( format_example) ;
12941296 }
12951297 }
12961298
1297- writeln ! ( result, "**{}**: {}" , help_options. grouped_label, command. group_name) . unwrap ( ) ;
1299+ writeln ! ( result, "**{}**: {}" , help_options. grouped_label, command. group_name)
1300+ . expect ( "writing to a string should never fail" ) ;
12981301
12991302 if !help_options. available_text . is_empty ( ) && !command. availability . is_empty ( ) {
1300- writeln ! ( result, "**{}**: {}" , help_options. available_text, command. availability) . unwrap ( ) ;
1303+ writeln ! ( result, "**{}**: {}" , help_options. available_text, command. availability)
1304+ . expect ( "writing to a string should never fail" ) ;
13011305 }
13021306
13031307 if !command. sub_commands . is_empty ( ) {
@@ -1307,7 +1311,7 @@ fn single_command_to_plain_string(help_options: &HelpOptions, command: &Command<
13071311 help_options. sub_commands_label,
13081312 command. sub_commands. join( "`, `" ) ,
13091313 )
1310- . unwrap ( ) ;
1314+ . expect ( "writing to a string should never fail" ) ;
13111315 }
13121316
13131317 result
@@ -1385,8 +1389,7 @@ pub async fn plain(
13851389 msg. channel_id . say ( & ctx, result) . await
13861390}
13871391
1388- #[ cfg( test) ]
1389- #[ cfg( all( feature = "cache" , feature = "http" ) ) ]
1392+ #[ cfg( all( test, feature = "cache" , feature = "http" ) ) ]
13901393mod tests {
13911394 use super :: { SuggestedCommandName , Suggestions } ;
13921395
0 commit comments