Skip to content

Commit 72aeaef

Browse files
committed
Purge of unwraps
1 parent f96442a commit 72aeaef

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

crates/rust-analyzer/src/handlers/request.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,20 +2039,19 @@ fn to_url(path: VfsPath) -> Option<Url> {
20392039
}
20402040

20412041
fn resource_ops_supported(config: &Config, kind: ResourceOperationKind) -> anyhow::Result<()> {
2042-
let ctn = config
2043-
.caps()
2044-
.workspace
2045-
.as_ref()
2046-
.unwrap()
2047-
.workspace_edit
2048-
.as_ref()
2049-
.unwrap()
2050-
.resource_operations
2051-
.as_ref()
2052-
.unwrap()
2053-
.contains(&kind);
2054-
2055-
if !ctn {
2042+
#[rustfmt::skip]
2043+
let resops = (|| {
2044+
config
2045+
.caps()
2046+
.workspace
2047+
.as_ref()?
2048+
.workspace_edit
2049+
.as_ref()?
2050+
.resource_operations
2051+
.as_ref()
2052+
})();
2053+
2054+
if resops.is_none() || !resops.unwrap().contains(&kind) {
20562055
return Err(LspError::new(
20572056
ErrorCode::RequestFailed as i32,
20582057
format!(

0 commit comments

Comments
 (0)