Skip to content

Commit dc348db

Browse files
committed
Auto merge of #114448 - SteveLauC:std_fs_read_doc, r=Mark-Simulacrum
docs: improve std::fs::read doc #### What does this PR do 1. Rephrase a confusing sentence in the document of `std::fs::read()` ----- Closes #114432 cc `@Dexus0` `@saethlin`
2 parents 88d9b37 + 0e270b1 commit dc348db

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

library/std/src/fs.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ pub struct DirBuilder {
233233
/// This function will return an error if `path` does not already exist.
234234
/// Other errors may also be returned according to [`OpenOptions::open`].
235235
///
236-
/// It will also return an error if it encounters while reading an error
237-
/// of a kind other than [`io::ErrorKind::Interrupted`].
236+
/// While reading from the file, this function handles [`io::ErrorKind::Interrupted`]
237+
/// with automatic retries. See [io::Read] documentation for details.
238238
///
239239
/// # Examples
240240
///
@@ -271,9 +271,11 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
271271
/// This function will return an error if `path` does not already exist.
272272
/// Other errors may also be returned according to [`OpenOptions::open`].
273273
///
274-
/// It will also return an error if it encounters while reading an error
275-
/// of a kind other than [`io::ErrorKind::Interrupted`],
276-
/// or if the contents of the file are not valid UTF-8.
274+
/// If the contents of the file are not valid UTF-8, then an error will also be
275+
/// returned.
276+
///
277+
/// While reading from the file, this function handles [`io::ErrorKind::Interrupted`]
278+
/// with automatic retries. See [io::Read] documentation for details.
277279
///
278280
/// # Examples
279281
///

0 commit comments

Comments
 (0)