about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSteve Lau <stevelauc@outlook.com>2023-09-01 10:54:37 +0800
committerSteve Lau <stevelauc@outlook.com>2023-09-01 10:54:37 +0800
commit0e270b1a972151bd7daf73b04c942369b06d1a63 (patch)
treeaf21d18803126ebd2b4b37b6d55d1f51a3660b03
parent60fa393490ef88c79da2a58569795236b4d4c9db (diff)
downloadrust-0e270b1a972151bd7daf73b04c942369b06d1a63.tar.gz
rust-0e270b1a972151bd7daf73b04c942369b06d1a63.zip
docs: improve std::fs::read doc
-rw-r--r--library/std/src/fs.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index 0f79e74f555..9e9491f9861 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -233,8 +233,8 @@ pub struct DirBuilder {
 /// This function will return an error if `path` does not already exist.
 /// Other errors may also be returned according to [`OpenOptions::open`].
 ///
-/// It will also return an error if it encounters while reading an error
-/// of a kind other than [`io::ErrorKind::Interrupted`].
+/// While reading from the file, this function handles [`io::ErrorKind::Interrupted`]
+/// with automatic retries. See [io::Read] documentation for details.
 ///
 /// # Examples
 ///
@@ -271,9 +271,11 @@ pub fn read<P: AsRef<Path>>(path: P) -> io::Result<Vec<u8>> {
 /// This function will return an error if `path` does not already exist.
 /// Other errors may also be returned according to [`OpenOptions::open`].
 ///
-/// It will also return an error if it encounters while reading an error
-/// of a kind other than [`io::ErrorKind::Interrupted`],
-/// or if the contents of the file are not valid UTF-8.
+/// If the contents of the file are not valid UTF-8, then an error will also be
+/// returned.
+///
+/// While reading from the file, this function handles [`io::ErrorKind::Interrupted`]
+/// with automatic retries. See [io::Read] documentation for details.
 ///
 /// # Examples
 ///