mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
cleanup: match over unwrap
This commit is contained in:
parent
021e97ea03
commit
ecd1c11f9e
@ -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 New Issue
Block a user