Use path.exists() instead of fs::metadata(path).is_ok()

It's more explicit and allows platforms to optimize the existence check.
This commit is contained in:
Chris Denton 2021-05-07 17:32:40 +01:00
parent e5f83d24ae
commit d9a58f4c87
No known key found for this signature in database
GPG key ID: 713472F2F45627DE
2 changed files with 2 additions and 2 deletions

View file

@ -109,7 +109,7 @@ pub struct RealFileLoader;
impl FileLoader for RealFileLoader {
fn file_exists(&self, path: &Path) -> bool {
fs::metadata(path).is_ok()
path.exists()
}
fn read_file(&self, path: &Path) -> io::Result<String> {