Skip to content

Commit a09a496

Browse files
committed
Long lines
1 parent bc9efaa commit a09a496

File tree

9 files changed

+77
-67
lines changed

9 files changed

+77
-67
lines changed

src/libstd/arc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ mod tests {
718718
// send to other readers
719719
for vec::each(reader_convos) |x| {
720720
match *x {
721-
(rc, _) => rc.send(()),
721+
(ref rc, _) => rc.send(()),
722722
}
723723
}
724724
}
@@ -727,7 +727,7 @@ mod tests {
727727
// complete handshake with other readers
728728
for vec::each(reader_convos) |x| {
729729
match *x {
730-
(_, rp) => rp.recv(),
730+
(_, ref rp) => rp.recv(),
731731
}
732732
}
733733
wc1.send(()); // tell writer to try again

src/libstd/getopts.rs

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,21 @@ enum Fail_ {
199199
/// Convert a `fail_` enum into an error string
200200
fn fail_str(+f: Fail_) -> ~str {
201201
return match f {
202-
ArgumentMissing(ref nm) => ~"Argument to option '" + *nm + ~"' missing.",
203-
UnrecognizedOption(ref nm) => ~"Unrecognized option: '" + *nm + ~"'.",
204-
OptionMissing(ref nm) => ~"Required option '" + *nm + ~"' missing.",
205-
OptionDuplicated(ref nm) => ~"Option '" + *nm + ~"' given more than once.",
206-
UnexpectedArgument(ref nm) => {
207-
~"Option " + *nm + ~" does not take an argument."
208-
}
202+
ArgumentMissing(ref nm) => {
203+
~"Argument to option '" + *nm + ~"' missing."
204+
}
205+
UnrecognizedOption(ref nm) => {
206+
~"Unrecognized option: '" + *nm + ~"'."
207+
}
208+
OptionMissing(ref nm) => {
209+
~"Required option '" + *nm + ~"' missing."
210+
}
211+
OptionDuplicated(ref nm) => {
212+
~"Option '" + *nm + ~"' given more than once."
213+
}
214+
UnexpectedArgument(ref nm) => {
215+
~"Option " + *nm + ~" does not take an argument."
216+
}
209217
};
210218
}
211219

@@ -476,7 +484,7 @@ mod tests {
476484
let opts = ~[reqopt(~"test")];
477485
let rs = getopts(args, opts);
478486
match rs {
479-
Ok(m) => {
487+
Ok(copy m) => {
480488
assert (opt_present(m, ~"test"));
481489
assert (opt_str(m, ~"test") == ~"20");
482490
}
@@ -490,7 +498,7 @@ mod tests {
490498
let opts = ~[reqopt(~"test")];
491499
let rs = getopts(args, opts);
492500
match rs {
493-
Err(f) => check_fail_type(f, OptionMissing_),
501+
Err(copy f) => check_fail_type(f, OptionMissing_),
494502
_ => fail
495503
}
496504
}
@@ -501,7 +509,7 @@ mod tests {
501509
let opts = ~[reqopt(~"test")];
502510
let rs = getopts(args, opts);
503511
match rs {
504-
Err(f) => check_fail_type(f, ArgumentMissing_),
512+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
505513
_ => fail
506514
}
507515
}
@@ -512,7 +520,7 @@ mod tests {
512520
let opts = ~[reqopt(~"test")];
513521
let rs = getopts(args, opts);
514522
match rs {
515-
Err(f) => check_fail_type(f, OptionDuplicated_),
523+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
516524
_ => fail
517525
}
518526
}
@@ -523,7 +531,7 @@ mod tests {
523531
let opts = ~[reqopt(~"t")];
524532
let rs = getopts(args, opts);
525533
match rs {
526-
Ok(m) => {
534+
Ok(copy m) => {
527535
assert (opt_present(m, ~"t"));
528536
assert (opt_str(m, ~"t") == ~"20");
529537
}
@@ -537,7 +545,7 @@ mod tests {
537545
let opts = ~[reqopt(~"t")];
538546
let rs = getopts(args, opts);
539547
match rs {
540-
Err(f) => check_fail_type(f, OptionMissing_),
548+
Err(copy f) => check_fail_type(f, OptionMissing_),
541549
_ => fail
542550
}
543551
}
@@ -548,7 +556,7 @@ mod tests {
548556
let opts = ~[reqopt(~"t")];
549557
let rs = getopts(args, opts);
550558
match rs {
551-
Err(f) => check_fail_type(f, ArgumentMissing_),
559+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
552560
_ => fail
553561
}
554562
}
@@ -559,7 +567,7 @@ mod tests {
559567
let opts = ~[reqopt(~"t")];
560568
let rs = getopts(args, opts);
561569
match rs {
562-
Err(f) => check_fail_type(f, OptionDuplicated_),
570+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
563571
_ => fail
564572
}
565573
}
@@ -572,7 +580,7 @@ mod tests {
572580
let opts = ~[optopt(~"test")];
573581
let rs = getopts(args, opts);
574582
match rs {
575-
Ok(m) => {
583+
Ok(copy m) => {
576584
assert (opt_present(m, ~"test"));
577585
assert (opt_str(m, ~"test") == ~"20");
578586
}
@@ -586,7 +594,7 @@ mod tests {
586594
let opts = ~[optopt(~"test")];
587595
let rs = getopts(args, opts);
588596
match rs {
589-
Ok(m) => assert (!opt_present(m, ~"test")),
597+
Ok(copy m) => assert (!opt_present(m, ~"test")),
590598
_ => fail
591599
}
592600
}
@@ -597,7 +605,7 @@ mod tests {
597605
let opts = ~[optopt(~"test")];
598606
let rs = getopts(args, opts);
599607
match rs {
600-
Err(f) => check_fail_type(f, ArgumentMissing_),
608+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
601609
_ => fail
602610
}
603611
}
@@ -608,7 +616,7 @@ mod tests {
608616
let opts = ~[optopt(~"test")];
609617
let rs = getopts(args, opts);
610618
match rs {
611-
Err(f) => check_fail_type(f, OptionDuplicated_),
619+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
612620
_ => fail
613621
}
614622
}
@@ -619,7 +627,7 @@ mod tests {
619627
let opts = ~[optopt(~"t")];
620628
let rs = getopts(args, opts);
621629
match rs {
622-
Ok(m) => {
630+
Ok(copy m) => {
623631
assert (opt_present(m, ~"t"));
624632
assert (opt_str(m, ~"t") == ~"20");
625633
}
@@ -633,7 +641,7 @@ mod tests {
633641
let opts = ~[optopt(~"t")];
634642
let rs = getopts(args, opts);
635643
match rs {
636-
Ok(m) => assert (!opt_present(m, ~"t")),
644+
Ok(copy m) => assert (!opt_present(m, ~"t")),
637645
_ => fail
638646
}
639647
}
@@ -644,7 +652,7 @@ mod tests {
644652
let opts = ~[optopt(~"t")];
645653
let rs = getopts(args, opts);
646654
match rs {
647-
Err(f) => check_fail_type(f, ArgumentMissing_),
655+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
648656
_ => fail
649657
}
650658
}
@@ -655,7 +663,7 @@ mod tests {
655663
let opts = ~[optopt(~"t")];
656664
let rs = getopts(args, opts);
657665
match rs {
658-
Err(f) => check_fail_type(f, OptionDuplicated_),
666+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
659667
_ => fail
660668
}
661669
}
@@ -668,7 +676,7 @@ mod tests {
668676
let opts = ~[optflag(~"test")];
669677
let rs = getopts(args, opts);
670678
match rs {
671-
Ok(m) => assert (opt_present(m, ~"test")),
679+
Ok(copy m) => assert (opt_present(m, ~"test")),
672680
_ => fail
673681
}
674682
}
@@ -679,7 +687,7 @@ mod tests {
679687
let opts = ~[optflag(~"test")];
680688
let rs = getopts(args, opts);
681689
match rs {
682-
Ok(m) => assert (!opt_present(m, ~"test")),
690+
Ok(copy m) => assert (!opt_present(m, ~"test")),
683691
_ => fail
684692
}
685693
}
@@ -690,7 +698,7 @@ mod tests {
690698
let opts = ~[optflag(~"test")];
691699
let rs = getopts(args, opts);
692700
match rs {
693-
Err(f) => {
701+
Err(copy f) => {
694702
log(error, fail_str(f));
695703
check_fail_type(f, UnexpectedArgument_);
696704
}
@@ -704,7 +712,7 @@ mod tests {
704712
let opts = ~[optflag(~"test")];
705713
let rs = getopts(args, opts);
706714
match rs {
707-
Err(f) => check_fail_type(f, OptionDuplicated_),
715+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
708716
_ => fail
709717
}
710718
}
@@ -715,7 +723,7 @@ mod tests {
715723
let opts = ~[optflag(~"t")];
716724
let rs = getopts(args, opts);
717725
match rs {
718-
Ok(m) => assert (opt_present(m, ~"t")),
726+
Ok(copy m) => assert (opt_present(m, ~"t")),
719727
_ => fail
720728
}
721729
}
@@ -726,7 +734,7 @@ mod tests {
726734
let opts = ~[optflag(~"t")];
727735
let rs = getopts(args, opts);
728736
match rs {
729-
Ok(m) => assert (!opt_present(m, ~"t")),
737+
Ok(copy m) => assert (!opt_present(m, ~"t")),
730738
_ => fail
731739
}
732740
}
@@ -737,7 +745,7 @@ mod tests {
737745
let opts = ~[optflag(~"t")];
738746
let rs = getopts(args, opts);
739747
match rs {
740-
Ok(m) => {
748+
Ok(ref m) => {
741749
// The next variable after the flag is just a free argument
742750

743751
assert (m.free[0] == ~"20");
@@ -752,7 +760,7 @@ mod tests {
752760
let opts = ~[optflag(~"t")];
753761
let rs = getopts(args, opts);
754762
match rs {
755-
Err(f) => check_fail_type(f, OptionDuplicated_),
763+
Err(copy f) => check_fail_type(f, OptionDuplicated_),
756764
_ => fail
757765
}
758766
}
@@ -765,7 +773,7 @@ mod tests {
765773
let opts = ~[optmulti(~"test")];
766774
let rs = getopts(args, opts);
767775
match rs {
768-
Ok(m) => {
776+
Ok(copy m) => {
769777
assert (opt_present(m, ~"test"));
770778
assert (opt_str(m, ~"test") == ~"20");
771779
}
@@ -779,7 +787,7 @@ mod tests {
779787
let opts = ~[optmulti(~"test")];
780788
let rs = getopts(args, opts);
781789
match rs {
782-
Ok(m) => assert (!opt_present(m, ~"test")),
790+
Ok(copy m) => assert (!opt_present(m, ~"test")),
783791
_ => fail
784792
}
785793
}
@@ -790,7 +798,7 @@ mod tests {
790798
let opts = ~[optmulti(~"test")];
791799
let rs = getopts(args, opts);
792800
match rs {
793-
Err(f) => check_fail_type(f, ArgumentMissing_),
801+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
794802
_ => fail
795803
}
796804
}
@@ -801,7 +809,7 @@ mod tests {
801809
let opts = ~[optmulti(~"test")];
802810
let rs = getopts(args, opts);
803811
match rs {
804-
Ok(m) => {
812+
Ok(copy m) => {
805813
assert (opt_present(m, ~"test"));
806814
assert (opt_str(m, ~"test") == ~"20");
807815
let pair = opt_strs(m, ~"test");
@@ -818,7 +826,7 @@ mod tests {
818826
let opts = ~[optmulti(~"t")];
819827
let rs = getopts(args, opts);
820828
match rs {
821-
Ok(m) => {
829+
Ok(copy m) => {
822830
assert (opt_present(m, ~"t"));
823831
assert (opt_str(m, ~"t") == ~"20");
824832
}
@@ -832,7 +840,7 @@ mod tests {
832840
let opts = ~[optmulti(~"t")];
833841
let rs = getopts(args, opts);
834842
match rs {
835-
Ok(m) => assert (!opt_present(m, ~"t")),
843+
Ok(copy m) => assert (!opt_present(m, ~"t")),
836844
_ => fail
837845
}
838846
}
@@ -843,7 +851,7 @@ mod tests {
843851
let opts = ~[optmulti(~"t")];
844852
let rs = getopts(args, opts);
845853
match rs {
846-
Err(f) => check_fail_type(f, ArgumentMissing_),
854+
Err(copy f) => check_fail_type(f, ArgumentMissing_),
847855
_ => fail
848856
}
849857
}
@@ -854,7 +862,7 @@ mod tests {
854862
let opts = ~[optmulti(~"t")];
855863
let rs = getopts(args, opts);
856864
match rs {
857-
Ok(m) => {
865+
Ok(copy m) => {
858866
assert (opt_present(m, ~"t"));
859867
assert (opt_str(m, ~"t") == ~"20");
860868
let pair = opt_strs(m, ~"t");
@@ -871,7 +879,7 @@ mod tests {
871879
let opts = ~[optmulti(~"t")];
872880
let rs = getopts(args, opts);
873881
match rs {
874-
Err(f) => check_fail_type(f, UnrecognizedOption_),
882+
Err(copy f) => check_fail_type(f, UnrecognizedOption_),
875883
_ => fail
876884
}
877885
}
@@ -882,7 +890,7 @@ mod tests {
882890
let opts = ~[optmulti(~"test")];
883891
let rs = getopts(args, opts);
884892
match rs {
885-
Err(f) => check_fail_type(f, UnrecognizedOption_),
893+
Err(copy f) => check_fail_type(f, UnrecognizedOption_),
886894
_ => fail
887895
}
888896
}
@@ -899,7 +907,7 @@ mod tests {
899907
optopt(~"notpresent")];
900908
let rs = getopts(args, opts);
901909
match rs {
902-
Ok(m) => {
910+
Ok(copy m) => {
903911
assert (m.free[0] == ~"prog");
904912
assert (m.free[1] == ~"free1");
905913
assert (opt_str(m, ~"s") == ~"20");
@@ -924,8 +932,8 @@ mod tests {
924932
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
925933
let opts = ~[optopt(~"e"), optopt(~"encrypt")];
926934
let matches = match getopts(args, opts) {
927-
result::Ok(m) => m,
928-
result::Err(_f) => fail
935+
result::Ok(move m) => m,
936+
result::Err(_) => fail
929937
};
930938
assert opts_present(matches, ~[~"e"]);
931939
assert opts_present(matches, ~[~"encrypt"]);
@@ -945,8 +953,8 @@ mod tests {
945953
let args = ~[~"-Lfoo"];
946954
let opts = ~[optmulti(~"L")];
947955
let matches = match getopts(args, opts) {
948-
result::Ok(m) => m,
949-
result::Err(_f) => fail
956+
result::Ok(move m) => m,
957+
result::Err(_) => fail
950958
};
951959
assert opts_present(matches, ~[~"L"]);
952960
assert opts_str(matches, ~[~"L"]) == ~"foo";

src/libstd/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ mod tests {
11331133

11341134
for items.each |item| {
11351135
match *item {
1136-
(key, value) => { d.insert(copy key, copy value); },
1136+
(copy key, copy value) => { d.insert(key, value); },
11371137
}
11381138
};
11391139

0 commit comments

Comments
 (0)