Skip to content

Commit

Permalink
Rollup merge of rust-lang#78606 - autarch:patch-1, r=m-ou-se
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
m-ou-se authored Nov 1, 2020
2 parents 92fa615 + b2d7b3a commit 68ddcad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion library/core/src/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,9 @@ impl str {
/// Lines are ended with either a newline (`\n`) or a carriage return with
/// a line feed (`\r\n`).
///
/// The final line ending is optional.
/// The final line ending is optional. A string that ends with a final line
/// ending will return the same lines as an otherwise identical string
/// without a final line ending.
///
/// # Examples
///
Expand Down

0 comments on commit 68ddcad

Please sign in to comment.