Purge of unwraps

This commit is contained in:
Ali Bektas 2023-06-30 15:46:39 +02:00
parent f96442aa90
commit 72aeaef5f3

View File

@ -2039,20 +2039,19 @@ fn to_url(path: VfsPath) -> Option<Url> {
} }
fn resource_ops_supported(config: &Config, kind: ResourceOperationKind) -> anyhow::Result<()> { fn resource_ops_supported(config: &Config, kind: ResourceOperationKind) -> anyhow::Result<()> {
let ctn = config #[rustfmt::skip]
.caps() let resops = (|| {
.workspace config
.as_ref() .caps()
.unwrap() .workspace
.workspace_edit .as_ref()?
.as_ref() .workspace_edit
.unwrap() .as_ref()?
.resource_operations .resource_operations
.as_ref() .as_ref()
.unwrap() })();
.contains(&kind);
if !ctn { if resops.is_none() || !resops.unwrap().contains(&kind) {
return Err(LspError::new( return Err(LspError::new(
ErrorCode::RequestFailed as i32, ErrorCode::RequestFailed as i32,
format!( format!(