about summary refs log tree commit diff
path: root/library/core/src
diff options
context:
space:
mode:
authorDave Rolsky <autarch@urth.org>2020-10-31 11:34:32 -0500
committerGitHub <noreply@github.com>2020-10-31 11:34:32 -0500
commit47279b33e03587e55c50eacdf710d64ff15f17fb (patch)
tree1bbbe05f87f2c23762bf333a106921b42c336bb1 /library/core/src
parent3478d7c3607ffbba629af2265c01002771e48c18 (diff)
downloadrust-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.
Diffstat (limited to 'library/core/src')
-rw-r--r--library/core/src/str/mod.rs4
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
     ///