diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 1cf4139d2..7bfbc6103 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -1336,12 +1336,12 @@ pub(crate) fn handle_open_cargo_toml( | |||
1336 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { | 1336 | ) -> Result<Option<lsp_types::GotoDefinitionResponse>> { |
1337 | let _p = profile::span("handle_open_cargo_toml"); | 1337 | let _p = profile::span("handle_open_cargo_toml"); |
1338 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; | 1338 | let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; |
1339 | let maybe_cargo_spec = CargoTargetSpec::for_file(&snap, file_id)?; | ||
1340 | if maybe_cargo_spec.is_none() { | ||
1341 | return Ok(None); | ||
1342 | } | ||
1343 | 1339 | ||
1344 | let cargo_spec = maybe_cargo_spec.unwrap(); | 1340 | let cargo_spec = match CargoTargetSpec::for_file(&snap, file_id)? { |
1341 | Some(it) => it, | ||
1342 | None => return Ok(None), | ||
1343 | }; | ||
1344 | |||
1345 | let cargo_toml_path = cargo_spec.workspace_root.join("Cargo.toml"); | 1345 | let cargo_toml_path = cargo_spec.workspace_root.join("Cargo.toml"); |
1346 | if !cargo_toml_path.exists() { | 1346 | if !cargo_toml_path.exists() { |
1347 | return Ok(None); | 1347 | return Ok(None); |