From 47279b33e03587e55c50eacdf710d64ff15f17fb Mon Sep 17 00:00:00 2001 From: Dave Rolsky Date: Sat, 31 Oct 2020 11:34:32 -0500 Subject: [PATCH 1/2] 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 b36d9f5c38841..f4e8529a58f6f 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 /// From b2d7b3aa26e1821bfdfd8be8a8b65cd6e674ff04 Mon Sep 17 00:00:00 2001 From: Dave Rolsky Date: Sun, 1 Nov 2020 09:11:20 -0600 Subject: [PATCH 2/2] Remove incorrect statement about line ending content in lines doc change --- library/core/src/str/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index f4e8529a58f6f..5658e28fbff11 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -843,8 +843,8 @@ impl str { /// a line feed (`\r\n`). /// /// 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. + /// ending will return the same lines as an otherwise identical string + /// without a final line ending. /// /// # Examples ///