diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2025-03-05 21:46:38 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-05 21:46:38 +0800 |
| commit | 4f1a0479a72da2e8f2dac4c808c611c7cf1134e8 (patch) | |
| tree | 897ac98a40900bad4dc0dccfbe723cee26e64131 /library/std/src/fs.rs | |
| parent | ab29c707ba6bfd6cf72abe75f627ec720113c19a (diff) | |
| parent | 477a2eeb3dd5a430bb3845c8f8041ff369232967 (diff) | |
| download | rust-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.rs | 8 |
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. /// |
