mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155652 - ChrisDenton:empty-docs, r=jhpratt
Expand `Path::is_empty` docs Give some reasons why you might want to check if a path is empty. The `Path::join` behaviour can be surprising if you're not aware it might happen.
This commit is contained in:
@@ -2828,6 +2828,10 @@ fn _ends_with(&self, child: &Path) -> bool {
|
||||
|
||||
/// Checks whether the `Path` is empty.
|
||||
///
|
||||
/// Passing an empty path to most OS filesystem APIs will always result in an error.
|
||||
///
|
||||
/// [Pushing][PathBuf::push] an empty path to an existing path will append a directory separator unless it already ends with a separator or the existing path is itself empty.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
||||
Reference in New Issue
Block a user