diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-06-22 19:33:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 19:33:55 +0200 |
| commit | f3ced9d5406d83bb8b300603da494cd67a85dad3 (patch) | |
| tree | 0130f23340fed43cb831a1ebabebf0ae858296ef /library/std/src/sys_common | |
| parent | ac47dbad504b892bc0f3be8fa097537c6e0544a3 (diff) | |
| parent | 6a04dfe78c2bf6a4331e8da02959e821b68dbf22 (diff) | |
| download | rust-f3ced9d5406d83bb8b300603da494cd67a85dad3.tar.gz rust-f3ced9d5406d83bb8b300603da494cd67a85dad3.zip | |
Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu
Rename `std::fs::try_exists` to `std::fs::exists` and stabilize fs_try_exists
FCP completed in tracking issue.
Tracking issue: https://github.com/rust-lang/rust/issues/83186
Closes https://github.com/rust-lang/rust/issues/83186
Stabilized API:
```rust
mod fs {
pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>;
}
```
Diffstat (limited to 'library/std/src/sys_common')
| -rw-r--r-- | library/std/src/sys_common/fs.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys_common/fs.rs b/library/std/src/sys_common/fs.rs index 617ac52e51c..acb6713cf1b 100644 --- a/library/std/src/sys_common/fs.rs +++ b/library/std/src/sys_common/fs.rs @@ -42,7 +42,7 @@ fn remove_dir_all_recursive(path: &Path) -> io::Result<()> { fs::remove_dir(path) } -pub fn try_exists(path: &Path) -> io::Result<bool> { +pub fn exists(path: &Path) -> io::Result<bool> { match fs::metadata(path) { Ok(_) => Ok(true), Err(error) if error.kind() == io::ErrorKind::NotFound => Ok(false), |
