From f85d231301b506b512bb36d80c840d8478329b25 Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Sat, 8 Aug 2020 22:50:56 -0700 Subject: [PATCH] clarify documentation of remove_dir errors remove_dir will error if the path doesn't exist or isn't a directory. It's useful to clarify that this is "remove dir or fail" not "remove dir if it exists". I don't think this belongs in the title. "Removes an existing, empty directory" is strangely worded-- there's no such thing as a non-existing directory. Better to just say explicitly it will return an error. --- library/std/src/fs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 047478fcc85..ea4e096b05e 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1991,7 +1991,7 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { DirBuilder::new().recursive(true).create(path.as_ref()) } -/// Removes an existing, empty directory. +/// Removes an empty directory. /// /// # Platform-specific behavior /// @@ -2006,6 +2006,8 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { /// This function will return an error in the following situations, but is not /// limited to just these cases: /// +/// * `path` doesn't exist. +/// * `path` isn't a directory. /// * The user lacks permissions to remove the directory at the provided `path`. /// * The directory isn't empty. ///