From 974b3dbd957d2a68c691a5e141046a047ab5beee Mon Sep 17 00:00:00 2001 From: koushiro Date: Tue, 3 Sep 2024 22:29:44 +0800 Subject: [PATCH] fix(services/icloud): adjust error handling code to avoid having to write out result type explicitly --- 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 c62ba60330d..306c0ad206b 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 {