diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 45308c4b3e9c5..ab7389a1300c5 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -1251,6 +1251,8 @@ impl str { /// ending will return the same lines as an otherwise identical string /// without a final line ending. /// + /// An empty string returns an empty iterator. + /// /// # Examples /// /// Basic usage: @@ -1281,6 +1283,15 @@ impl str { /// /// assert_eq!(None, lines.next()); /// ``` + /// + /// An empty string returns an empty iterator: + /// + /// ``` + /// let text = ""; + /// let mut lines = text.lines(); + /// + /// assert_eq!(lines.next(), None); + /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn lines(&self) -> Lines<'_> {