Skip to content

Commit 335bf51

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#137230.
2 parents 08109d3 + 477a2ee commit 335bf51

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: library/std/src/fs.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -2857,9 +2857,11 @@ pub fn remove_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
28572857
///
28582858
/// See [`fs::remove_file`] and [`fs::remove_dir`].
28592859
///
2860-
/// `remove_dir_all` will fail if `remove_dir` or `remove_file` fail on any constituent paths, including the root `path`.
2861-
/// As a result, the directory you are deleting must exist, meaning that this function is not idempotent.
2862-
/// Additionally, `remove_dir_all` will also fail if the `path` is not a directory.
2860+
/// [`remove_dir_all`] will fail if [`remove_dir`] or [`remove_file`] fail on *any* constituent
2861+
/// paths, *including* the root `path`. Consequently,
2862+
///
2863+
/// - The directory you are deleting *must* exist, meaning that this function is *not idempotent*.
2864+
/// - [`remove_dir_all`] will fail if the `path` is *not* a directory.
28632865
///
28642866
/// Consider ignoring the error if validating the removal is not required for your use case.
28652867
///

0 commit comments

Comments
 (0)