From ecd1c11f9e8ae7718f4243d1eb4c9a45efd060a2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Dec 2020 16:17:46 +0300 Subject: cleanup: match over unwrap --- crates/rust-analyzer/src/handlers.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates') 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( ) -> Result> { let _p = profile::span("handle_open_cargo_toml"); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; - let maybe_cargo_spec = CargoTargetSpec::for_file(&snap, file_id)?; - if maybe_cargo_spec.is_none() { - return Ok(None); - } - let cargo_spec = maybe_cargo_spec.unwrap(); + let cargo_spec = match CargoTargetSpec::for_file(&snap, file_id)? { + Some(it) => it, + None => return Ok(None), + }; + let cargo_toml_path = cargo_spec.workspace_root.join("Cargo.toml"); if !cargo_toml_path.exists() { return Ok(None); -- cgit v1.2.3