diff options
| author | Dave Rolsky <autarch@urth.org> | 2020-10-31 11:34:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-31 11:34:32 -0500 |
| commit | 47279b33e03587e55c50eacdf710d64ff15f17fb (patch) | |
| tree | 1bbbe05f87f2c23762bf333a106921b42c336bb1 | |
| parent | 3478d7c3607ffbba629af2265c01002771e48c18 (diff) | |
| download | rust-47279b33e03587e55c50eacdf710d64ff15f17fb.tar.gz rust-47279b33e03587e55c50eacdf710d64ff15f17fb.zip | |
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.
| -rw-r--r-- | library/core/src/str/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index b36d9f5c388..f4e8529a58f 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -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 (carriage return or line feed) will return the same lines as an + /// otherwise identical string without a final line ending. /// /// # Examples /// |
