Skip to content

Commit ecd1c11

Browse files
committed
cleanup: match over unwrap
1 parent 021e97e commit ecd1c11

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/rust-analyzer/src/handlers.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,12 +1336,12 @@ pub(crate) fn handle_open_cargo_toml(
13361336
) -> Result<Option<lsp_types::GotoDefinitionResponse>> {
13371337
let _p = profile::span("handle_open_cargo_toml");
13381338
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-
}
13431339

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+
13451345
let cargo_toml_path = cargo_spec.workspace_root.join("Cargo.toml");
13461346
if !cargo_toml_path.exists() {
13471347
return Ok(None);

0 commit comments

Comments
 (0)