@@ -345,7 +345,7 @@ pub fn getopts(args: &[~str], opts: &[Opt]) -> Result {
345
345
}
346
346
i += 1;
347
347
}
348
- return Ok(Matches {opts: vec:: to_owned(opts ),
348
+ return Ok(Matches {opts: opts. to_owned(),
349
349
vals: vals,
350
350
free: free});
351
351
}
@@ -447,7 +447,7 @@ pub fn opt_default(mm: &Matches, nm: &str, def: &str) -> Option<~str> {
447
447
let vals = opt_vals ( mm, nm) ;
448
448
if vals. is_empty ( ) { return None :: < ~str > ; }
449
449
return match vals[ 0 ] { Val ( ref s) => Some :: < ~str > ( copy * s) ,
450
- _ => Some :: < ~str > ( str :: to_owned ( def ) ) }
450
+ _ => Some :: < ~str > ( def . to_owned ( ) ) }
451
451
}
452
452
453
453
#[ deriving( Eq ) ]
@@ -487,10 +487,10 @@ pub mod groups {
487
487
desc : & str , hint : & str ) -> OptGroup {
488
488
let len = short_name. len ( ) ;
489
489
assert ! ( len == 1 || len == 0 ) ;
490
- return OptGroup { short_name : str :: to_owned ( short_name ) ,
491
- long_name : str :: to_owned ( long_name ) ,
492
- hint : str :: to_owned ( hint ) ,
493
- desc : str :: to_owned ( desc ) ,
490
+ return OptGroup { short_name : short_name . to_owned ( ) ,
491
+ long_name : long_name . to_owned ( ) ,
492
+ hint : hint . to_owned ( ) ,
493
+ desc : desc . to_owned ( ) ,
494
494
hasarg : Yes ,
495
495
occur : Req } ;
496
496
}
@@ -500,10 +500,10 @@ pub mod groups {
500
500
desc : & str , hint : & str ) -> OptGroup {
501
501
let len = short_name. len ( ) ;
502
502
assert ! ( len == 1 || len == 0 ) ;
503
- return OptGroup { short_name : str :: to_owned ( short_name ) ,
504
- long_name : str :: to_owned ( long_name ) ,
505
- hint : str :: to_owned ( hint ) ,
506
- desc : str :: to_owned ( desc ) ,
503
+ return OptGroup { short_name : short_name . to_owned ( ) ,
504
+ long_name : long_name . to_owned ( ) ,
505
+ hint : hint . to_owned ( ) ,
506
+ desc : desc . to_owned ( ) ,
507
507
hasarg : Yes ,
508
508
occur : Optional } ;
509
509
}
@@ -513,10 +513,10 @@ pub mod groups {
513
513
desc : & str ) -> OptGroup {
514
514
let len = short_name. len ( ) ;
515
515
assert ! ( len == 1 || len == 0 ) ;
516
- return OptGroup { short_name : str :: to_owned ( short_name ) ,
517
- long_name : str :: to_owned ( long_name ) ,
516
+ return OptGroup { short_name : short_name . to_owned ( ) ,
517
+ long_name : long_name . to_owned ( ) ,
518
518
hint: ~"",
519
- desc : str :: to_owned ( desc ) ,
519
+ desc : desc . to_owned ( ) ,
520
520
hasarg : No ,
521
521
occur : Optional } ;
522
522
}
@@ -526,10 +526,10 @@ pub mod groups {
526
526
desc : & str , hint : & str ) -> OptGroup {
527
527
let len = short_name. len ( ) ;
528
528
assert ! ( len == 1 || len == 0 ) ;
529
- return OptGroup { short_name : str :: to_owned ( short_name ) ,
530
- long_name : str :: to_owned ( long_name ) ,
531
- hint : str :: to_owned ( hint ) ,
532
- desc : str :: to_owned ( desc ) ,
529
+ return OptGroup { short_name : short_name . to_owned ( ) ,
530
+ long_name : long_name . to_owned ( ) ,
531
+ hint : hint . to_owned ( ) ,
532
+ desc : desc . to_owned ( ) ,
533
533
hasarg : Maybe ,
534
534
occur : Optional } ;
535
535
}
@@ -542,10 +542,10 @@ pub mod groups {
542
542
desc : & str , hint : & str ) -> OptGroup {
543
543
let len = short_name. len ( ) ;
544
544
assert ! ( len == 1 || len == 0 ) ;
545
- return OptGroup { short_name : str :: to_owned ( short_name ) ,
546
- long_name : str :: to_owned ( long_name ) ,
547
- hint : str :: to_owned ( hint ) ,
548
- desc : str :: to_owned ( desc ) ,
545
+ return OptGroup { short_name : short_name . to_owned ( ) ,
546
+ long_name : long_name . to_owned ( ) ,
547
+ hint : hint . to_owned ( ) ,
548
+ desc : desc . to_owned ( ) ,
549
549
hasarg : Yes ,
550
550
occur : Multi } ;
551
551
}
@@ -593,7 +593,7 @@ pub mod groups {
593
593
*/
594
594
pub fn usage( brief : & str , opts : & [ OptGroup ] ) -> ~str {
595
595
596
- let desc_sep = ~"\n " + str :: repeat ( " " , 24 ) ;
596
+ let desc_sep = ~"\n " + " " . repeat ( 24 ) ;
597
597
598
598
let rows = vec:: map ( opts, |optref| {
599
599
let OptGroup { short_name : short_name,
@@ -603,7 +603,7 @@ pub mod groups {
603
603
hasarg : hasarg,
604
604
_} = copy * optref;
605
605
606
- let mut row = str :: repeat ( " " , 4 ) ;
606
+ let mut row = " " . repeat ( 4 ) ;
607
607
608
608
// short option
609
609
row += match short_name. len ( ) {
@@ -629,7 +629,7 @@ pub mod groups {
629
629
// here we just need to indent the start of the description
630
630
let rowlen = row. len ( ) ;
631
631
row += if rowlen < 24 {
632
- str :: repeat ( " " , 24 - rowlen)
632
+ " " . repeat ( 24 - rowlen)
633
633
} else {
634
634
copy desc_sep
635
635
} ;
@@ -654,7 +654,7 @@ pub mod groups {
654
654
row
655
655
} ) ;
656
656
657
- return str :: to_owned ( brief ) +
657
+ return brief . to_owned ( ) +
658
658
"\n \n Options:\n " +
659
659
rows. connect ( "\n " ) +
660
660
"\n \n " ;
0 commit comments