about summary refs log tree commit diff
path: root/library/std/src/fs.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-05 21:46:38 +0800
committerGitHub <noreply@github.com>2025-03-05 21:46:38 +0800
commit4f1a0479a72da2e8f2dac4c808c611c7cf1134e8 (patch)
tree897ac98a40900bad4dc0dccfbe723cee26e64131 /library/std/src/fs.rs
parentab29c707ba6bfd6cf72abe75f627ec720113c19a (diff)
parent477a2eeb3dd5a430bb3845c8f8041ff369232967 (diff)
downloadrust-4f1a0479a72da2e8f2dac4c808c611c7cf1134e8.tar.gz
rust-4f1a0479a72da2e8f2dac4c808c611c7cf1134e8.zip
Rollup merge of #137240 - jieyouxu:remove_dir_all, r=Mark-Simulacrum
Slightly reformat `std::fs::remove_dir_all` error docs

To make the error cases easier to spot on a quick glance, as I've been bitten by this a couple of times already 💀

cc #137230.
Diffstat (limited to 'library/std/src/fs.rs')
-rw-r--r--library/std/src/fs.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs
index 57e235c3efe..4314c8a0b18 100644
--- a/library/std/src/fs.rs
+++ b/library/std/src/fs.rs
@@ -2857,9 +2857,11 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
 ///
 /// See [`fs::remove_file`] and [`fs::remove_dir`].
 ///
-/// `remove_dir_all` will fail if `remove_dir` or `remove_file` fail on any constituent paths, including the root `path`.
-/// As a result, the directory you are deleting must exist, meaning that this function is not idempotent.
-/// Additionally, `remove_dir_all` will also fail if the `path` is not a directory.
+/// [`remove_dir_all`] will fail if [`remove_dir`] or [`remove_file`] fail on *any* constituent
+/// paths, *including* the root `path`. Consequently,
+///
+/// - The directory you are deleting *must* exist, meaning that this function is *not idempotent*.
+/// - [`remove_dir_all`] will fail if the `path` is *not* a directory.
 ///
 /// Consider ignoring the error if validating the removal is not required for your use case.
 ///