Skip to content

Commit 7a3991a

Browse files
committed
Auto merge of rust-lang#15180 - alibektas:15176, r=Veykril
Purge of unwraps Removes unnecessary unwraps that I have overlooked in rust-lang#15101 ( fixes rust-lang#15176 )
2 parents f96442a + cfbeb66 commit 7a3991a

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 !matches!(resops, Some(resops) if resops.contains(&kind)) {
20562055
return Err(LspError::new(
20572056
ErrorCode::RequestFailed as i32,
20582057
format!(

0 commit comments

Comments
 (0)