diff options
| author | Bruno de Oliveira Abinader <bruno.d@partner.samsung.com> | 2014-02-24 23:34:26 -0400 |
|---|---|---|
| committer | Bruno de Oliveira Abinader <bruno.d@partner.samsung.com> | 2014-02-27 08:35:47 -0400 |
| commit | fed034c402eb22b60fb9d7581e720bb0010dae65 (patch) | |
| tree | e93aa4b8dfac8c0712cdcc650bb68d3a01ef6747 /src/test | |
| parent | 45fd63a8b7b1fa0242d864f9592c05d06669b395 (diff) | |
| download | rust-fed034c402eb22b60fb9d7581e720bb0010dae65.tar.gz rust-fed034c402eb22b60fb9d7581e720bb0010dae65.zip | |
Refactored list::head() to be based on List<T>
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/non-boolean-pure-fns.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs index 9cbf80c3105..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}; +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!(!ls.is_empty()); - return head(ls); + return ls.head().unwrap().clone(); } pub fn main() { |
