From 7b2026bf218c416c653faf8bb8cca770d0bb2c0d Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 31 Jul 2012 16:38:41 -0700 Subject: Introduce 'return', 'match' and 'module' as synonyms --- src/libstd/list.rs | 10 +++++----- src/libstd/test.rs | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/list.rs b/src/libstd/list.rs index 46bb01250fe..b8da3dcc38f 100644 --- a/src/libstd/list.rs +++ b/src/libstd/list.rs @@ -192,18 +192,18 @@ mod tests { #[test] fn test_find_success() { - fn match(&&i: int) -> bool { ret i == 2; } + fn match_(&&i: int) -> bool { ret i == 2; } let l = from_vec(~[0, 1, 2]); - assert (list::find(l, match) == option::some(2)); + assert (list::find(l, match_) == option::some(2)); } #[test] fn test_find_fail() { - fn match(&&_i: int) -> bool { ret false; } + fn match_(&&_i: int) -> bool { ret false; } let l = from_vec(~[0, 1, 2]); let empty = @list::nil::; - assert (list::find(l, match) == option::none::); - assert (list::find(empty, match) == option::none::); + assert (list::find(l, match_) == option::none::); + assert (list::find(empty, match_) == option::none::); } #[test] diff --git a/src/libstd/test.rs b/src/libstd/test.rs index f9e4f94ed80..6a7b27a3b6b 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -68,19 +68,19 @@ type opt_res = either; fn parse_opts(args: ~[~str]) -> opt_res { let args_ = vec::tail(args); let opts = ~[getopts::optflag(~"ignored"), getopts::optopt(~"logfile")]; - let match = + let matches = alt getopts::getopts(args_, opts) { ok(m) { m } err(f) { ret either::right(getopts::fail_str(f)) } }; let filter = - if vec::len(match.free) > 0u { - option::some(match.free[0]) + if vec::len(matches.free) > 0u { + option::some(matches.free[0]) } else { option::none }; - let run_ignored = getopts::opt_present(match, ~"ignored"); - let logfile = getopts::opt_maybe_str(match, ~"logfile"); + let run_ignored = getopts::opt_present(matches, ~"ignored"); + let logfile = getopts::opt_maybe_str(matches, ~"logfile"); let test_opts = {filter: filter, run_ignored: run_ignored, logfile: logfile}; -- cgit 1.4.1-3-g733a5