Skip to content

Commit 47279b3

Browse files
authored
Clarify handling of final line ending in str::lines()
I found the description as it stands a bit confusing. I've added a bit more explanation to make it clear that a trailing line ending does not produce a final empty line.
1 parent 3478d7c commit 47279b3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/core/src/str/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,9 @@ impl str {
842842
/// Lines are ended with either a newline (`\n`) or a carriage return with
843843
/// a line feed (`\r\n`).
844844
///
845-
/// The final line ending is optional.
845+
/// The final line ending is optional. A string that ends with a final line
846+
/// ending (carriage return or line feed) will return the same lines as an
847+
/// otherwise identical string without a final line ending.
846848
///
847849
/// # Examples
848850
///

0 commit comments

Comments
 (0)