From 0c70ae8a6fa1957ee8206a14f4755a4342348b1c Mon Sep 17 00:00:00 2001 From: Qinxuan Chen Date: Tue, 3 Sep 2024 22:56:37 +0800 Subject: [PATCH] fix(services/icloud): adjust error handling code to avoid having to write out result type explicitly (#5091) --- core/src/services/icloud/core.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/services/icloud/core.rs b/core/src/services/icloud/core.rs index c62ba60330df..306c0ad206b9 100644 --- a/core/src/services/icloud/core.rs +++ b/core/src/services/icloud/core.rs @@ -526,11 +526,11 @@ impl PathQuery for IcloudPathQuery { let node = &root[0]; - let id = match node.items.iter().find(|it| it.name == name) { - Some(it) => Ok(Some(it.drivewsid.clone())), - None => Ok(None), - }?; - Ok(id) + Ok(node + .items + .iter() + .find(|it| it.name == name) + .map(|it| it.drivewsid.clone())) } async fn create_dir(&self, parent_id: &str, name: &str) -> Result {