Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. Tweak std lib vec fns in process.

This commit is contained in:
Graydon Hoare 2011-03-16 14:58:02 -07:00
parent 23eef4da22
commit 54587bdccb
29 changed files with 278 additions and 225 deletions

View file

@ -39,12 +39,12 @@ fn mkstate(io.writer out, uint width) -> ps {
impure fn push_context(ps p, contexttype tp, uint indent) {
before_print(p, false);
p.context = _vec.push[context](p.context, rec(tp=tp, indent=base_indent(p)
+ indent));
_vec.push[context](p.context, rec(tp=tp, indent=base_indent(p)
+ indent));
}
impure fn pop_context(ps p) {
p.context = _vec.pop[context](p.context);
fn pop_context(ps p) {
_vec.pop[context](p.context);
}
impure fn add_token(ps p, token tok) {
@ -110,7 +110,8 @@ impure fn finish_block_scan(ps p, contexttype tp) {
}
p.scandepth = 0u;
push_context(p, tp, indent);
for (token t in _vec.shift[token](p.buffered)) {add_token(p, t);}
_vec.shift[token](p.buffered);
for (token t in p.buffered) { add_token(p, t); }
}
impure fn finish_break_scan(ps p) {
@ -125,7 +126,8 @@ impure fn finish_break_scan(ps p) {
p.col += width;
}
p.scandepth = 0u;
for (token t in _vec.shift[token](p.buffered)) {add_token(p, t);}
_vec.shift[token](p.buffered);
for (token t in p.buffered) { add_token(p, t); }
}
impure fn start_scan(ps p, token tok) {

View file

@ -717,7 +717,7 @@ fn escape_str(str st, char to_escape) -> str {
case ('\\') {out += "\\\\";}
case (?cur) {
if (cur == to_escape) {out += "\\";}
out += cur as u8;
_str.push_byte(out, cur as u8);
}
}
i += 1u;