Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

fs: Handle io::ErrorKind::NotADirectory in fs::metadata (#42370)

Piotr Osiewicz6e1d86f311f4
diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs
index 53af6ba6afc..b8714505093 100644
--- a/crates/fs/src/fs.rs
+++ b/crates/fs/src/fs.rs
@@ -719,9 +719,8 @@ impl Fs for RealFs {
{
Ok(metadata) => metadata,
Err(err) => {
- return match (err.kind(), err.raw_os_error()) {
- (io::ErrorKind::NotFound, _) => Ok(None),
- (io::ErrorKind::Other, Some(libc::ENOTDIR)) => Ok(None),
+ return match err.kind() {
+ io::ErrorKind::NotFound | io::ErrorKind::NotADirectory => Ok(None),
_ => Err(anyhow::Error::new(err)),
};
}