Skip to content

Commit d9a58f4

Browse files
committed
Use path.exists() instead of fs::metadata(path).is_ok()
It's more explicit and allows platforms to optimize the existence check.
1 parent e5f83d2 commit d9a58f4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

compiler/rustc_codegen_ssa/src/back/linker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ impl<'a> Linker for MsvcLinker<'a> {
764764
// check to see if the file is there and just omit linking to it if it's
765765
// not present.
766766
let name = format!("{}.dll.lib", lib);
767-
if fs::metadata(&path.join(&name)).is_ok() {
767+
if path.join(&name).exists() {
768768
self.cmd.arg(name);
769769
}
770770
}

compiler/rustc_span/src/source_map.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ pub struct RealFileLoader;
109109

110110
impl FileLoader for RealFileLoader {
111111
fn file_exists(&self, path: &Path) -> bool {
112-
fs::metadata(path).is_ok()
112+
path.exists()
113113
}
114114

115115
fn read_file(&self, path: &Path) -> io::Result<String> {

0 commit comments

Comments
 (0)