Rollup merge of #75324 - ericseppanen:master, r=JohnTitor

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.
This commit is contained in:
Yuki Okushi 2020-08-21 17:55:08 +09:00 committed by GitHub
commit f2d25538d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -1921,7 +1921,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
DirBuilder::new().recursive(true).create(path.as_ref()) DirBuilder::new().recursive(true).create(path.as_ref())
} }
/// Removes an existing, empty directory. /// Removes an empty directory.
/// ///
/// # Platform-specific behavior /// # Platform-specific behavior
/// ///
@ -1936,6 +1936,8 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// This function will return an error in the following situations, but is not /// This function will return an error in the following situations, but is not
/// limited to just these cases: /// 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 user lacks permissions to remove the directory at the provided `path`.
/// * The directory isn't empty. /// * The directory isn't empty.
/// ///