Skip to content

Commit

Permalink
std::fs: slightly reformat remove_dir_all error docs
Browse files Browse the repository at this point in the history
To make the error cases easier to spot on a quick glance.
  • Loading branch information
jieyouxu committed Feb 18, 2025
1 parent 3b022d8 commit 477a2ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions library/std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2841,9 +2841,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.
///
Expand Down

0 comments on commit 477a2ee

Please sign in to comment.