]> git.lizzy.rs Git - rust.git/commit - src/tools/rustfmt
Rollup merge of #81822 - Kixunil:path_try_exists, r=kennytm
authorYuki Okushi <huyuumi.dev@gmail.com>
Tue, 16 Mar 2021 14:53:52 +0000 (23:53 +0900)
committerGitHub <noreply@github.com>
Tue, 16 Mar 2021 14:53:52 +0000 (23:53 +0900)
commit62d38da9fab089520b0e10e71a54be0d30b0490a
treeba3cc8360b17d7ae546fc31d410bcbab9c691ca4
parentf24ce9b0140d9be5a336954e878d0c1522966bb8
parent4330268181c3de234457138f23bb821afd0c181e
Rollup merge of #81822 - Kixunil:path_try_exists, r=kennytm

Added `try_exists()` method to `std::path::Path`

This method is similar to the existing `exists()` method, except it
doesn't silently ignore the errors, leading to less error-prone code.

This change intentionally does NOT touch the documentation of `exists()`
nor recommend people to use this method while it's unstable.
Such changes are reserved for stabilization to prevent confusing people.

Apart from that it avoids conflicts with #80979.

`@joshtriplett` requested this PR in [internals discussion](https://internals.rust-lang.org/t/the-api-of-path-exists-encourages-broken-code/13817/25?u=kixunil)
library/std/src/path.rs