Ignore metadata file in `RustLspAdapter::get_cached_server_binary` (#35708)

Lukas Wirth created

Follows https://github.com/zed-industries/zed/pull/35642

Release Notes:

- Fixed accidentally picking a non executable as a rust-analyzer server
when downloading fails

Change summary

crates/languages/src/rust.rs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

Detailed changes

crates/languages/src/rust.rs 🔗

@@ -1039,7 +1039,11 @@ async fn get_cached_server_binary(container_dir: PathBuf) -> Option<LanguageServ
         let mut last = None;
         let mut entries = fs::read_dir(&container_dir).await?;
         while let Some(entry) = entries.next().await {
-            last = Some(entry?.path());
+            let path = entry?.path();
+            if path.extension().is_some_and(|ext| ext == "metadata") {
+                continue;
+            }
+            last = Some(path);
         }
 
         anyhow::Ok(LanguageServerBinary {