@@ -392,7 +392,7 @@ impl<'a> Help<'a> {
392
392
393
393
fn write_before_after_help ( & mut self , h : & str ) -> io:: Result < ( ) > {
394
394
debugln ! ( "Help::write_before_after_help;" ) ;
395
- let mut help = String :: new ( ) ;
395
+ let mut help = String :: from ( h ) ;
396
396
// determine if our help fits or needs to wrap
397
397
debugln ! ( "Help::write_before_after_help: Term width...{}" ,
398
398
self . term_w) ;
@@ -401,7 +401,6 @@ impl<'a> Help<'a> {
401
401
debug ! ( "Help::write_before_after_help: Too long..." ) ;
402
402
if too_long || h. contains ( "{n}" ) {
403
403
sdebugln ! ( "Yes" ) ;
404
- help. push_str ( h) ;
405
404
debugln ! ( "Help::write_before_after_help: help: {}" , help) ;
406
405
debugln ! ( "Help::write_before_after_help: help width: {}" ,
407
406
str_width( & * help) ) ;
@@ -414,12 +413,6 @@ impl<'a> Help<'a> {
414
413
} else {
415
414
sdebugln ! ( "No" ) ;
416
415
}
417
- let help = if !help. is_empty ( ) {
418
- & * help
419
- } else {
420
- help. push_str ( h) ;
421
- & * help
422
- } ;
423
416
if help. contains ( '\n' ) {
424
417
if let Some ( part) = help. lines ( ) . next ( ) {
425
418
try!( write ! ( self . writer, "{}" , part) ) ;
@@ -436,12 +429,12 @@ impl<'a> Help<'a> {
436
429
/// Writes argument's help to the wrapped stream.
437
430
fn help < ' b , ' c > ( & mut self , arg : & ArgWithDisplay < ' b , ' c > , spec_vals : & str ) -> io:: Result < ( ) > {
438
431
debugln ! ( "Help::help;" ) ;
439
- let mut help = String :: new ( ) ;
440
432
let h = if self . use_long {
441
433
arg. long_help ( ) . unwrap_or ( arg. help ( ) . unwrap_or ( "" ) )
442
434
} else {
443
435
arg. help ( ) . unwrap_or ( arg. long_help ( ) . unwrap_or ( "" ) )
444
436
} ;
437
+ let mut help = String :: from ( h) + spec_vals;
445
438
let nlh = self . next_line_help || arg. is_set ( ArgSettings :: NextLineHelp ) || self . use_long ;
446
439
debugln ! ( "Help::help: Next Line...{:?}" , nlh) ;
447
440
@@ -461,8 +454,6 @@ impl<'a> Help<'a> {
461
454
debug ! ( "Help::help: Too long..." ) ;
462
455
if too_long && spcs <= self . term_w || h. contains ( "{n}" ) {
463
456
sdebugln ! ( "Yes" ) ;
464
- help. push_str ( h) ;
465
- help. push_str ( & * spec_vals) ;
466
457
debugln ! ( "Help::help: help...{}" , help) ;
467
458
debugln ! ( "Help::help: help width...{}" , str_width( & * help) ) ;
468
459
// Determine how many newlines we need to insert
@@ -474,15 +465,6 @@ impl<'a> Help<'a> {
474
465
} else {
475
466
sdebugln ! ( "No" ) ;
476
467
}
477
- let help = if !help. is_empty ( ) {
478
- & * help
479
- } else if spec_vals. is_empty ( ) {
480
- h
481
- } else {
482
- help. push_str ( h) ;
483
- help. push_str ( & * spec_vals) ;
484
- & * help
485
- } ;
486
468
if help. contains ( '\n' ) {
487
469
if let Some ( part) = help. lines ( ) . next ( ) {
488
470
try!( write ! ( self . writer, "{}" , part) ) ;
0 commit comments