mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
cleanup: match over unwrap
This commit is contained in:
parent
021e97ea03
commit
ecd1c11f9e
1 changed files with 5 additions and 5 deletions
|
@ -1336,12 +1336,12 @@ pub(crate) fn handle_open_cargo_toml(
|
|||
) -> Result<Option<lsp_types::GotoDefinitionResponse>> {
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue