diff options
| author | Eric Holk <eric.holk@gmail.com> | 2012-06-26 00:39:18 -0700 |
|---|---|---|
| committer | Eric Holk <eric.holk@gmail.com> | 2012-06-26 00:39:18 -0700 |
| commit | b9d3ad0736dfc3a69f50155d2251f195de54b6c6 (patch) | |
| tree | 20dc484a67399477c9e25a40a3995810276b1482 /src/libsyntax/parse/comments.rs | |
| parent | 007b9d9acd8b04ad2e1984aeba79c2031dec0e45 (diff) | |
| download | rust-b9d3ad0736dfc3a69f50155d2251f195de54b6c6.tar.gz rust-b9d3ad0736dfc3a69f50155d2251f195de54b6c6.zip | |
Getting rid of lots more vector +=. (issue #2719)
Diffstat (limited to 'src/libsyntax/parse/comments.rs')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 2f10a30bd55..b6ab87ad1bc 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -44,7 +44,7 @@ fn consume_non_eol_whitespace(rdr: string_reader) { fn push_blank_line_comment(rdr: string_reader, &comments: [cmnt]/~) { #debug(">>> blank-line comment"); let v: [str]/~ = []/~; - comments += [{style: blank_line, lines: v, pos: rdr.chpos}]/~; + vec::push(comments, {style: blank_line, lines: v, pos: rdr.chpos}); } fn consume_whitespace_counting_blank_lines(rdr: string_reader, @@ -73,7 +73,7 @@ fn read_line_comments(rdr: string_reader, code_to_the_left: bool) -> cmnt { while rdr.curr == '/' && nextch(rdr) == '/' { let line = read_one_line_comment(rdr); log(debug, line); - lines += [line]/~; + vec::push(lines, line); consume_non_eol_whitespace(rdr); } #debug("<<< line comments"); @@ -98,7 +98,7 @@ fn trim_whitespace_prefix_and_push_line(&lines: [str]/~, } else { s1 = ""; } } else { s1 = s; } log(debug, "pushing line: " + s1); - lines += [s1]/~; + vec::push(lines, s1); } fn read_block_comment(rdr: string_reader, code_to_the_left: bool) -> cmnt { @@ -156,11 +156,11 @@ fn consume_comment(rdr: string_reader, code_to_the_left: bool, &comments: [cmnt]/~) { #debug(">>> consume comment"); if rdr.curr == '/' && nextch(rdr) == '/' { - comments += [read_line_comments(rdr, code_to_the_left)]/~; + vec::push(comments, read_line_comments(rdr, code_to_the_left)); } else if rdr.curr == '/' && nextch(rdr) == '*' { - comments += [read_block_comment(rdr, code_to_the_left)]/~; + vec::push(comments, read_block_comment(rdr, code_to_the_left)); } else if rdr.curr == '#' && nextch(rdr) == '!' { - comments += [read_shebang_comment(rdr, code_to_the_left)]/~; + vec::push(comments, read_shebang_comment(rdr, code_to_the_left)); } else { fail; } #debug("<<< consume comment"); } |
