about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-09-04 08:50:56 +0000
committerbors <bors@rust-lang.org>2015-09-04 08:50:56 +0000
commitb4de424e4175eefb4fda6e3ed634acfab3ec0daf (patch)
tree64071602a54a1c9ad7699862ace3d11667dd422a /src/libsyntax/parse
parent9d1f8200e70ade40c12a095c763041bd4cfa9f21 (diff)
parent48615a68fb01d09749a5b73816d45e0d0669d1f9 (diff)
downloadrust-b4de424e4175eefb4fda6e3ed634acfab3ec0daf.tar.gz
rust-b4de424e4175eefb4fda6e3ed634acfab3ec0daf.zip
Auto merge of #28034 - alexcrichton:new-lines, r=aturon
This commit is an implementation of [RFC 1212][rfc] which tweaks the behavior of
the `str::lines` and `BufRead::lines` iterators. Both iterators now account for
`\r\n` sequences in addition to `\n`, allowing for less surprising behavior
across platforms (especially in the `BufRead` case). Splitting *only* on the
`\n` character can still be achieved with `split('\n')` in both cases.

The `str::lines_any` function is also now deprecated as `str::lines` is a
drop-in replacement for it.

[rfc]: https://github.com/rust-lang/rfcs/blob/master/text/1212-line-endings.md

Closes #28032
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/comments.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 467345624c2..9033208fbdb 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -132,7 +132,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
 
     if comment.starts_with("/*") {
         let lines = comment[3..comment.len() - 2]
-            .lines_any()
+            .lines()
             .map(|s| s.to_string())
             .collect::<Vec<String> >();