Skip to content

Commit f2d2553

Browse files
authored
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.
2 parents b51651a + f85d231 commit f2d2553

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/std/src/fs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1921,7 +1921,7 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
19211921
DirBuilder::new().recursive(true).create(path.as_ref())
19221922
}
19231923

1924-
/// Removes an existing, empty directory.
1924+
/// Removes an empty directory.
19251925
///
19261926
/// # Platform-specific behavior
19271927
///
@@ -1936,6 +1936,8 @@ pub fn create_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
19361936
/// This function will return an error in the following situations, but is not
19371937
/// limited to just these cases:
19381938
///
1939+
/// * `path` doesn't exist.
1940+
/// * `path` isn't a directory.
19391941
/// * The user lacks permissions to remove the directory at the provided `path`.
19401942
/// * The directory isn't empty.
19411943
///

0 commit comments

Comments
 (0)