]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/str/mod.rs
Rollup merge of #106328 - GuillaumeGomez:gui-test-explanation, r=notriddle
[rust.git] / library / core / src / str / mod.rs
index 45fd2caae52f4f27efe70ac4054c9660fc3bec99..ab2f8520ecb33d969a479891fdca82997b90144e 100644 (file)
@@ -368,7 +368,7 @@ pub const fn as_bytes(&self) -> &[u8] {
     #[inline(always)]
     pub unsafe fn as_bytes_mut(&mut self) -> &mut [u8] {
         // SAFETY: the cast from `&str` to `&[u8]` is safe since `str`
-        // has the same layout as `&[u8]` (only libstd can make this guarantee).
+        // has the same layout as `&[u8]` (only std can make this guarantee).
         // The pointer dereference is safe since it comes from a mutable reference which
         // is guaranteed to be valid for writes.
         unsafe { &mut *(self as *mut str as *mut [u8]) }
@@ -970,8 +970,10 @@ pub fn split_ascii_whitespace(&self) -> SplitAsciiWhitespace<'_> {
 
     /// An iterator over the lines of a string, as string slices.
     ///
-    /// Lines are ended with either a newline (`\n`) or a carriage return with
-    /// a line feed (`\r\n`).
+    /// Lines are split at line endings that are either newlines (`\n`) or
+    /// sequences of a carriage return followed by a line feed (`\r\n`).
+    ///
+    /// Line terminators are not included in the lines returned by the iterator.
     ///
     /// The final line ending is optional. A string that ends with a final line
     /// ending will return the same lines as an otherwise identical string