vec: remove BaseIter implementation

I removed the `static-method-test.rs` test because it was heavily based
on `BaseIter` and there are plenty of other more complex uses of static
methods anyway.
This commit is contained in:
Daniel Micay 2013-06-21 08:29:53 -04:00
parent c9342663df
commit d2e9912aea
181 changed files with 796 additions and 876 deletions

View file

@ -21,7 +21,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree]) -> bas
let exprs = get_exprs_from_tts(cx, tts);
let mut bytes = ~[];
for exprs.each |expr| {
for exprs.iter().advance |expr| {
match expr.node {
// expression is a literal
ast::expr_lit(lit) => match lit.node {

View file

@ -286,7 +286,7 @@ impl<'self> TraitDef<'self> {
_mitem: @ast::meta_item,
in_items: ~[@ast::item]) -> ~[@ast::item] {
let mut result = ~[];
for in_items.each |item| {
for in_items.iter().advance |item| {
result.push(*item);
match item.node {
ast::item_struct(struct_def, ref generics) => {
@ -740,7 +740,7 @@ impl<'self> MethodDef<'self> {
let mut enum_matching_fields = vec::from_elem(self_vec.len(), ~[]);
for matches_so_far.tail().each |&(_, _, other_fields)| {
for matches_so_far.tail().iter().advance |&(_, _, other_fields)| {
for other_fields.iter().enumerate().advance |(i, &(_, other_field))| {
enum_matching_fields[i].push(other_field);
}
@ -870,7 +870,7 @@ fn summarise_struct(cx: @ExtCtxt, span: span,
struct_def: &struct_def) -> Either<uint, ~[ident]> {
let mut named_idents = ~[];
let mut unnamed_count = 0;
for struct_def.fields.each |field| {
for struct_def.fields.iter().advance |field| {
match field.node.kind {
ast::named_field(ident, _) => named_idents.push(ident),
ast::unnamed_field => unnamed_count += 1,

View file

@ -76,7 +76,7 @@ fn iter_bytes_substructure(cx: @ExtCtxt, span: span, substr: &Substructure) -> @
_ => cx.span_bug(span, "Impossible substructure in `deriving(IterBytes)`")
}
for fields.each |&(_, field, _)| {
for fields.iter().advance |&(_, field, _)| {
exprs.push(call_iterbytes(field));
}

View file

@ -70,7 +70,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
fn make_rt_conv_expr(cx: @ExtCtxt, sp: span, cnv: &Conv) -> @ast::expr {
fn make_flags(cx: @ExtCtxt, sp: span, flags: &[Flag]) -> @ast::expr {
let mut tmp_expr = make_rt_path_expr(cx, sp, "flag_none");
for flags.each |f| {
for flags.iter().advance |f| {
let fstr = match *f {
FlagLeftJustify => "flag_left_justify",
FlagLeftZeroPad => "flag_left_zero_pad",
@ -156,7 +156,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
option::None => (),
_ => cx.span_unimpl(sp, unsupported)
}
for cnv.flags.each |f| {
for cnv.flags.iter().advance |f| {
match *f {
FlagLeftJustify => (),
FlagSignAlways => {
@ -205,7 +205,7 @@ fn pieces_to_expr(cx: @ExtCtxt, sp: span,
Some(p) => { debug!("param: %s", p.to_str()); }
_ => debug!("param: none")
}
for c.flags.each |f| {
for c.flags.iter().advance |f| {
match *f {
FlagLeftJustify => debug!("flag: left justify"),
FlagLeftZeroPad => debug!("flag: left zero pad"),

View file

@ -209,7 +209,7 @@ impl to_type_decls for state {
let mut items_msg = ~[];
for self.messages.each |m| {
for self.messages.iter().advance |m| {
let message(name, span, tys, this, next) = copy *m;
let tys = match next {
@ -372,7 +372,7 @@ impl gen_init for protocol {
fn buffer_ty_path(&self, cx: @ExtCtxt) -> @ast::Ty {
let mut params: OptVec<ast::TyParam> = opt_vec::Empty;
for (copy self.states).each |s| {
for (copy self.states).iter().advance |s| {
for s.generics.ty_params.each |tp| {
match params.find(|tpp| tp.ident == tpp.ident) {
None => params.push(*tp),
@ -433,7 +433,7 @@ impl gen_init for protocol {
let mut client_states = ~[];
let mut server_states = ~[];
for (copy self.states).each |s| {
for (copy self.states).iter().advance |s| {
items += s.to_type_decls(cx);
client_states += s.to_endpoint_decls(cx, send);

View file

@ -107,7 +107,7 @@ impl state_ {
/// Iterate over the states that can be reached in one message
/// from this state.
pub fn reachable(&self, f: &fn(state) -> bool) -> bool {
for self.messages.each |m| {
for self.messages.iter().advance |m| {
match *m {
message(_, _, _, _, Some(next_state { state: ref id, _ })) => {
let state = self.proto.get_state((*id));
@ -165,7 +165,7 @@ impl protocol_ {
}
pub fn has_ty_params(&self) -> bool {
for self.states.each |s| {
for self.states.iter().advance |s| {
if s.generics.ty_params.len() > 0 {
return true;
}

View file

@ -637,7 +637,7 @@ fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree)
fn mk_tts(cx: @ExtCtxt, sp: span, tts: &[ast::token_tree])
-> ~[@ast::stmt] {
let mut ss = ~[];
for tts.each |tt| {
for tts.iter().advance |tt| {
ss.push_all_move(mk_tt(cx, sp, tt));
}
ss

View file

@ -138,7 +138,7 @@ pub fn count_names(ms: &[matcher]) -> uint {
pub fn initial_matcher_pos(ms: ~[matcher], sep: Option<Token>, lo: BytePos)
-> ~MatcherPos {
let mut match_idx_hi = 0u;
for ms.each |elt| {
for ms.iter().advance |elt| {
match elt.node {
match_tok(_) => (),
match_seq(_,_,_,_,hi) => {
@ -195,7 +195,7 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match])
match *m {
codemap::spanned {node: match_tok(_), _} => (),
codemap::spanned {node: match_seq(ref more_ms, _, _, _, _), _} => {
for more_ms.each |next_m| {
for more_ms.iter().advance |next_m| {
n_rec(p_s, next_m, res, ret_val)
};
}
@ -211,8 +211,8 @@ pub fn nameize(p_s: @mut ParseSess, ms: &[matcher], res: &[@named_match])
}
}
let mut ret_val = HashMap::new();
for ms.each |m| { n_rec(p_s, m, res, &mut ret_val) }
return ret_val;
for ms.iter().advance |m| { n_rec(p_s, m, res, &mut ret_val) }
ret_val
}
pub enum parse_result {