diff options
| author | bors <bors@rust-lang.org> | 2014-02-27 21:46:53 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-02-27 21:46:53 -0800 |
| commit | f203fc7daf8d598a7eacee1a135f2fd92dc6382e (patch) | |
| tree | d9519b932dd81fc44b4290554a7722d729d1fdc2 /src/test | |
| parent | 700fd35fb9d448c5e1658c3cec9c1153c57cc802 (diff) | |
| parent | 4da6d041c268d58654d54b317288c940e5c623fd (diff) | |
| download | rust-f203fc7daf8d598a7eacee1a135f2fd92dc6382e.tar.gz rust-f203fc7daf8d598a7eacee1a135f2fd92dc6382e.zip | |
auto merge of #12348 : brunoabinader/rust/libcollections-list-refactory, r=alexcrichton
This PR includes: - Create an iterator for ```List<T>``` called ```Items<T>```; - Move all list operations inside ```List<T>``` impl; - Removed functions that are already provided by ```Iterator``` trait; - Refactor on ```len()``` and ```is_empty``` using ```Container``` trait; - Bunch of minor fixes; A replacement for using @ is intended, but still in discussion. Closes #12344.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/log-knows-the-names-of-variants-in-std.rs | 6 | ||||
| -rw-r--r-- | src/test/run-pass/non-boolean-pure-fns.rs | 12 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 05c5a7a67f5..0129740252c 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -11,7 +11,7 @@ // except according to those terms. extern crate collections; -use collections::list; +use collections::list::List; #[deriving(Clone)] enum foo { @@ -24,8 +24,8 @@ fn check_log<T>(exp: ~str, v: T) { } pub fn main() { - let x = list::from_vec([a(22u), b(~"hi")]); - let exp = ~"@Cons(a(22u), @Cons(b(~\"hi\"), @Nil))"; + let x = List::from_vec([a(22u), b(~"hi")]); + let exp = ~"Cons(a(22u), @Cons(b(~\"hi\"), @Nil))"; let act = format!("{:?}", x); assert!(act == exp); check_log(exp, x); diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index cb08c81d9e0..66bb2e702be 100644 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ b/src/test/run-pass/non-boolean-pure-fns.rs @@ -14,19 +14,19 @@ extern crate collections; -use collections::list::{List, Cons, Nil, head, is_empty}; +use collections::list::{List, Cons, Nil}; -fn pure_length_go<T:Clone>(ls: @List<T>, acc: uint) -> uint { +fn pure_length_go<T>(ls: @List<T>, acc: uint) -> uint { match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } } } -fn pure_length<T:Clone>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } +fn pure_length<T>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } -fn nonempty_list<T:Clone>(ls: @List<T>) -> bool { pure_length(ls) > 0u } +fn nonempty_list<T>(ls: @List<T>) -> bool { pure_length(ls) > 0u } fn safe_head<T:Clone>(ls: @List<T>) -> T { - assert!(!is_empty(ls)); - return head(ls); + assert!(!ls.is_empty()); + return ls.head().unwrap().clone(); } pub fn main() { |
