diff options
| author | bors <bors@rust-lang.org> | 2013-03-26 15:07:07 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-26 15:07:07 -0700 |
| commit | 3d588c528685fa0590ff91f189f0ef44a3815ec2 (patch) | |
| tree | 888656fb3e0e3ab7a5c4931c49487acf39a6d414 /src/libsyntax/parse | |
| parent | 3f7c74d0225354b93bf7649fed8cdd2774480106 (diff) | |
| parent | de468c8cd2f55124f98ae67941bc4c11dee92c14 (diff) | |
| download | rust-3d588c528685fa0590ff91f189f0ef44a3815ec2.tar.gz rust-3d588c528685fa0590ff91f189f0ef44a3815ec2.zip | |
auto merge of #5555 : Kimundi/rust/str-dealloc-3, r=catamorphism
- Most functions that used to return `~[~str]` for a list of substrings got turned into iterators over `&str` slices - Some cleanup of apis, docs and code layout
Diffstat (limited to 'src/libsyntax/parse')
| -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)); |
