diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-08-21 17:55:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-21 17:55:08 +0900 |
| commit | f2d25538d4fad07dd2ded520de968dbb85e84aa9 (patch) | |
| tree | caeb649210337245cb4197e077031a2972656585 | |
| parent | b51651ae9d0161967617be930415705b2e4d5faf (diff) | |
| parent | f85d231301b506b512bb36d80c840d8478329b25 (diff) | |
| download | rust-f2d25538d4fad07dd2ded520de968dbb85e84aa9.tar.gz rust-f2d25538d4fad07dd2ded520de968dbb85e84aa9.zip | |
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.
| -rw-r--r-- | library/std/src/fs.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 2767675ff92..b1630f8f549 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1921,7 +1921,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { DirBuilder::new().recursive(true).create(path.as_ref()) } -/// Removes an existing, empty directory. +/// Removes an empty directory. /// /// # 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 /// 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. /// |
