@@ -243,8 +243,8 @@ fn handle_invalid_value_error(err: Error, maybe_colorize: impl Fn(&str, Color) -
243243 } else {
244244 // Fallback if we can't extract context - use clap's default formatting
245245 let rendered_str = err. render ( ) . to_string ( ) ;
246- let lines : Vec < & str > = rendered_str . lines ( ) . collect ( ) ;
247- if let Some ( main_error_line) = lines. first ( ) {
246+
247+ if let Some ( main_error_line) = rendered_str . lines ( ) . next ( ) {
248248 eprintln ! ( "{main_error_line}" ) ;
249249 eprintln ! ( ) ;
250250 eprintln ! ( "{}" , translate!( "common-help-suggestion" ) ) ;
@@ -284,10 +284,9 @@ pub fn handle_clap_error_with_exit_code(err: Error, util_name: &str, exit_code:
284284 }
285285
286286 // For other simple validation errors, use the same simple format as other errors
287- let lines: Vec < & str > = rendered_str. lines ( ) . collect ( ) ;
288- if let Some ( main_error_line) = lines. first ( ) {
287+ if let Some ( main_error_line) = rendered_str. lines ( ) . next ( ) {
289288 // Keep the "error: " prefix for test compatibility
290- eprintln ! ( "{}" , main_error_line ) ;
289+ eprintln ! ( "{main_error_line}" ) ;
291290 eprintln ! ( ) ;
292291 // Use the execution phrase for the help suggestion to match test expectations
293292 eprintln ! ( "{}" , translate!( "common-help-suggestion" ) ) ;
@@ -323,11 +322,10 @@ pub fn handle_clap_error_with_exit_code(err: Error, util_name: &str, exit_code:
323322
324323 // For other errors, show just the error and help suggestion
325324 let rendered_str = err. render ( ) . to_string ( ) ;
326- let lines: Vec < & str > = rendered_str. lines ( ) . collect ( ) ;
327325
328326 // Print error message (first line)
329- if let Some ( first_line) = lines. first ( ) {
330- eprintln ! ( "{}" , first_line ) ;
327+ if let Some ( first_line) = rendered_str . lines ( ) . next ( ) {
328+ eprintln ! ( "{first_line}" ) ;
331329 }
332330
333331 // For other errors, just show help suggestion
0 commit comments