@@ -171,7 +171,7 @@ fn is_arg(arg: &str) -> bool {
171
171
fn name_str ( nm : & Name ) -> ~str {
172
172
return match * nm {
173
173
Short ( ch) => str:: from_char ( ch) ,
174
- Long ( ref s) => copy * s
174
+ Long ( copy s) => s
175
175
} ;
176
176
}
177
177
@@ -390,7 +390,7 @@ pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
390
390
* argument
391
391
*/
392
392
pub fn opt_str ( mm : & Matches , nm : & str ) -> ~str {
393
- return match opt_val ( mm, nm) { Val ( s) => s, _ => fail ! ( ) } ;
393
+ return match opt_val ( mm, nm) { Val ( copy s) => s, _ => fail ! ( ) } ;
394
394
}
395
395
396
396
/**
@@ -402,7 +402,7 @@ pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
402
402
pub fn opts_str ( mm : & Matches , names : & [ ~str ] ) -> ~str {
403
403
for names. each |nm| {
404
404
match opt_val ( mm, * nm) {
405
- Val ( ref s) => return copy * s,
405
+ Val ( copy s) => return s,
406
406
_ => ( )
407
407
}
408
408
}
@@ -419,7 +419,7 @@ pub fn opts_str(mm: &Matches, names: &[~str]) -> ~str {
419
419
pub fn opt_strs ( mm : & Matches , nm : & str ) -> ~[ ~str ] {
420
420
let mut acc: ~[ ~str ] = ~[ ] ;
421
421
for vec:: each( opt_vals( mm, nm) ) |v| {
422
- match * v { Val ( ref s) => acc. push ( copy * s) , _ => ( ) }
422
+ match * v { Val ( copy s) => acc. push ( s) , _ => ( ) }
423
423
}
424
424
return acc;
425
425
}
@@ -429,7 +429,7 @@ pub fn opt_maybe_str(mm: &Matches, nm: &str) -> Option<~str> {
429
429
let vals = opt_vals ( mm, nm) ;
430
430
if vec:: len :: < Optval > ( vals) == 0 u { return None :: < ~str > ; }
431
431
return match vals[ 0 ] {
432
- Val ( ref s) => Some ( copy * s) ,
432
+ Val ( copy s) => Some ( s) ,
433
433
_ => None
434
434
} ;
435
435
}
@@ -445,7 +445,7 @@ pub fn opt_maybe_str(mm: &Matches, nm: &str) -> Option<~str> {
445
445
pub fn opt_default ( mm : & Matches , nm : & str , def : & str ) -> Option < ~str > {
446
446
let vals = opt_vals ( mm, nm) ;
447
447
if vec:: len :: < Optval > ( vals) == 0 u { return None :: < ~str > ; }
448
- return match vals[ 0 ] { Val ( ref s) => Some :: < ~str > ( copy * s) ,
448
+ return match vals[ 0 ] { Val ( copy s) => Some :: < ~str > ( s) ,
449
449
_ => Some :: < ~str > ( str:: to_owned ( def) ) }
450
450
}
451
451
@@ -701,7 +701,7 @@ mod tests {
701
701
let opts = ~[reqopt(" test")];
702
702
let rs = getopts(args, opts);
703
703
match rs {
704
- Err(f) => check_fail_type(f, OptionMissing_),
704
+ Err(copy f) => check_fail_type(f, OptionMissing_),
705
705
_ => fail!()
706
706
}
707
707
}
@@ -712,7 +712,7 @@ mod tests {
712
712
let opts = ~[reqopt(" test")];
713
713
let rs = getopts(args, opts);
714
714
match rs {
715
- Err(f) => check_fail_type(f, ArgumentMissing_),
715
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
716
716
_ => fail!()
717
717
}
718
718
}
@@ -723,7 +723,7 @@ mod tests {
723
723
let opts = ~[reqopt(" test")];
724
724
let rs = getopts(args, opts);
725
725
match rs {
726
- Err(f) => check_fail_type(f, OptionDuplicated_),
726
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
727
727
_ => fail!()
728
728
}
729
729
}
@@ -748,7 +748,7 @@ mod tests {
748
748
let opts = ~[reqopt(" t")];
749
749
let rs = getopts(args, opts);
750
750
match rs {
751
- Err(f) => check_fail_type(f, OptionMissing_),
751
+ Err(copy f) => check_fail_type(f, OptionMissing_),
752
752
_ => fail!()
753
753
}
754
754
}
@@ -759,7 +759,7 @@ mod tests {
759
759
let opts = ~[reqopt(" t")];
760
760
let rs = getopts(args, opts);
761
761
match rs {
762
- Err(f) => check_fail_type(f, ArgumentMissing_),
762
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
763
763
_ => fail!()
764
764
}
765
765
}
@@ -770,7 +770,7 @@ mod tests {
770
770
let opts = ~[reqopt(" t")];
771
771
let rs = getopts(args, opts);
772
772
match rs {
773
- Err(f) => check_fail_type(f, OptionDuplicated_),
773
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
774
774
_ => fail!()
775
775
}
776
776
}
@@ -808,7 +808,7 @@ mod tests {
808
808
let opts = ~[optopt(" test")];
809
809
let rs = getopts(args, opts);
810
810
match rs {
811
- Err(f) => check_fail_type(f, ArgumentMissing_),
811
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
812
812
_ => fail!()
813
813
}
814
814
}
@@ -819,7 +819,7 @@ mod tests {
819
819
let opts = ~[optopt(" test")];
820
820
let rs = getopts(args, opts);
821
821
match rs {
822
- Err(f) => check_fail_type(f, OptionDuplicated_),
822
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
823
823
_ => fail!()
824
824
}
825
825
}
@@ -855,7 +855,7 @@ mod tests {
855
855
let opts = ~[optopt(" t")];
856
856
let rs = getopts(args, opts);
857
857
match rs {
858
- Err(f) => check_fail_type(f, ArgumentMissing_),
858
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
859
859
_ => fail!()
860
860
}
861
861
}
@@ -866,7 +866,7 @@ mod tests {
866
866
let opts = ~[optopt(" t")];
867
867
let rs = getopts(args, opts);
868
868
match rs {
869
- Err(f) => check_fail_type(f, OptionDuplicated_),
869
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
870
870
_ => fail!()
871
871
}
872
872
}
@@ -901,7 +901,7 @@ mod tests {
901
901
let opts = ~[optflag(" test")];
902
902
let rs = getopts(args, opts);
903
903
match rs {
904
- Err(f) => {
904
+ Err(copy f) => {
905
905
error!(fail_str(copy f));
906
906
check_fail_type(f, UnexpectedArgument_);
907
907
}
@@ -915,7 +915,7 @@ mod tests {
915
915
let opts = ~[optflag(" test")];
916
916
let rs = getopts(args, opts);
917
917
match rs {
918
- Err(f) => check_fail_type(f, OptionDuplicated_),
918
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
919
919
_ => fail!()
920
920
}
921
921
}
@@ -963,7 +963,7 @@ mod tests {
963
963
let opts = ~[optflag(" t")];
964
964
let rs = getopts(args, opts);
965
965
match rs {
966
- Err(f) => check_fail_type(f, OptionDuplicated_),
966
+ Err(copy f) => check_fail_type(f, OptionDuplicated_),
967
967
_ => fail!()
968
968
}
969
969
}
@@ -1066,7 +1066,7 @@ mod tests {
1066
1066
let opts = ~[optmulti(" test")];
1067
1067
let rs = getopts(args, opts);
1068
1068
match rs {
1069
- Err(f) => check_fail_type(f, ArgumentMissing_),
1069
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
1070
1070
_ => fail!()
1071
1071
}
1072
1072
}
@@ -1119,7 +1119,7 @@ mod tests {
1119
1119
let opts = ~[optmulti(" t")];
1120
1120
let rs = getopts(args, opts);
1121
1121
match rs {
1122
- Err(f) => check_fail_type(f, ArgumentMissing_),
1122
+ Err(copy f) => check_fail_type(f, ArgumentMissing_),
1123
1123
_ => fail!()
1124
1124
}
1125
1125
}
@@ -1147,7 +1147,7 @@ mod tests {
1147
1147
let opts = ~[optmulti(" t")];
1148
1148
let rs = getopts(args, opts);
1149
1149
match rs {
1150
- Err(f) => check_fail_type(f, UnrecognizedOption_),
1150
+ Err(copy f) => check_fail_type(f, UnrecognizedOption_),
1151
1151
_ => fail!()
1152
1152
}
1153
1153
}
@@ -1158,7 +1158,7 @@ mod tests {
1158
1158
let opts = ~[optmulti(" test")];
1159
1159
let rs = getopts(args, opts);
1160
1160
match rs {
1161
- Err(f) => check_fail_type(f, UnrecognizedOption_),
1161
+ Err(copy f) => check_fail_type(f, UnrecognizedOption_),
1162
1162
_ => fail!()
1163
1163
}
1164
1164
}
0 commit comments