From 48615a68fb01d09749a5b73816d45e0d0669d1f9 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 26 Aug 2015 17:30:45 -0700 Subject: std: Account for CRLF in {str, BufRead}::lines 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 --- src/libsyntax/parse/lexer/comments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsyntax') 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:: >(); -- cgit 1.4.1-3-g733a5