std: remove foldr and alli methods in vec

This commit is contained in:
Huon Wilson 2013-06-08 18:28:08 +10:00
parent ed299af625
commit 513d2292e5
14 changed files with 26 additions and 37 deletions

View file

@ -1025,11 +1025,11 @@ pub fn cs_fold(use_foldl: bool,
match *substructure.fields {
EnumMatching(_, _, ref all_fields) | Struct(ref all_fields) => {
if use_foldl {
do all_fields.foldl(base) |&old, &(_, self_f, other_fs)| {
do all_fields.iter().fold(base) |old, &(_, self_f, other_fs)| {
f(cx, span, old, self_f, other_fs)
}
} else {
do all_fields.foldr(base) |&(_, self_f, other_fs), old| {
do all_fields.rev_iter().fold(base) |old, &(_, self_f, other_fs)| {
f(cx, span, old, self_f, other_fs)
}
}
@ -1094,11 +1094,11 @@ pub fn cs_same_method_fold(use_foldl: bool,
cs_same_method(
|cx, span, vals| {
if use_foldl {
do vals.foldl(base) |&old, &new| {
do vals.iter().fold(base) |old, &new| {
f(cx, span, old, new)
}
} else {
do vals.foldr(base) |&new, old| {
do vals.rev_iter().fold(base) |old, &new| {
f(cx, span, old, new)
}
}

View file

@ -19,6 +19,7 @@ library.
*/
use core::prelude::*;
use core::iterator::IteratorUtil;
use ast::{enum_def, ident, item, Generics, meta_item, struct_def};
use ext::base::ExtCtxt;
@ -74,7 +75,7 @@ pub fn expand_meta_deriving(cx: @ExtCtxt,
in_items
}
meta_list(_, ref titems) => {
do titems.foldr(in_items) |&titem, in_items| {
do titems.rev_iter().fold(in_items) |in_items, &titem| {
match titem.node {
meta_name_value(tname, _) |
meta_list(tname, _) |