aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-12-08 13:17:46 +0000
committerAleksey Kladov <[email protected]>2020-12-08 13:17:46 +0000
commitecd1c11f9e8ae7718f4243d1eb4c9a45efd060a2 (patch)
treec3a63a574745b30dfc07efbb6b7eb26e5e545f51 /crates
parent021e97ea03cf67ad7785ab39580e04bc69506b8c (diff)
cleanup: match over unwrap
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/handlers.rs10
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, &params.text_document.uri)?; 1338 let file_id = from_proto::file_id(&snap, &params.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);