Skip to content

Commit b509262

Browse files
authored
Rollup merge of #85044 - ChrisDenton:file-exists, r=jackh726
Use `path.exists()` instead of `fs::metadata(path).is_ok()` It's more explicit and potentially allows platforms to optimize the existence check.
2 parents b4a0020 + d9a58f4 commit b509262

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
@@ -772,7 +772,7 @@ impl<'a> Linker for MsvcLinker<'a> {
772772
// check to see if the file is there and just omit linking to it if it's
773773
// not present.
774774
let name = format!("{}.dll.lib", lib);
775-
if fs::metadata(&path.join(&name)).is_ok() {
775+
if path.join(&name).exists() {
776776
self.cmd.arg(name);
777777
}
778778
}

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)