From 47279b33e03587e55c50eacdf710d64ff15f17fb Mon Sep 17 00:00:00 2001 From: Dave Rolsky Date: Sat, 31 Oct 2020 11:34:32 -0500 Subject: [PATCH] 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. --- library/core/src/str/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index b36d9f5c3884..f4e8529a58f6 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 ///