diff options
| author | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-24 07:51:18 +0100 |
|---|---|---|
| committer | Marvin Löbel <loebel.marvin@gmail.com> | 2013-03-26 14:59:17 +0100 |
| commit | b9de2b5787440bbb196fd38223ef4a6a6f196f83 (patch) | |
| tree | a724b2b66ef1aaccddae1398cdc098714326f2f6 /src/libsyntax | |
| parent | d74606ead60d524eb72afad2cd8b45facd6c5d40 (diff) | |
| download | rust-b9de2b5787440bbb196fd38223ef4a6a6f196f83.tar.gz rust-b9de2b5787440bbb196fd38223ef4a6a6f196f83.zip | |
Switched over a bunch of splitting funktions to non-allocating iterators
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 3f8a5588c71..1b6b25db38a 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -99,7 +99,8 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { } return do lines.map |line| { - let chars = str::chars(*line); + let mut chars = ~[]; + for str::each_char(*line) |c| { chars.push(c) } if i > chars.len() { ~"" } else { @@ -116,7 +117,10 @@ pub fn strip_doc_comment_decoration(comment: &str) -> ~str { } if comment.starts_with(~"/*") { - let lines = str::lines_any(comment.slice(3u, comment.len() - 2u).to_owned()); + let mut lines = ~[]; + for str::each_line_any(comment.slice(3u, comment.len() - 2u)) |line| { + lines.push(line.to_owned()) + } let lines = vertical_trim(lines); let lines = block_trim(lines, ~"\t ", None); let lines = block_trim(lines, ~"*", Some(1u)); |
