From 9a1aff25bd11c10d44b6a47dfdbd231f34c4b9eb Mon Sep 17 00:00:00 2001 From: wongjiahau Date: Tue, 14 Mar 2023 12:33:45 +0800 Subject: [PATCH] refactor(ui/explorer/close_documents): concise code Resolve https://github.com/helix-editor/helix/pull/5768#discussion_r1133065427 --- helix-term/src/ui/explorer.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/helix-term/src/ui/explorer.rs b/helix-term/src/ui/explorer.rs index 24c37ed6..a8ea640a 100644 --- a/helix-term/src/ui/explorer.rs +++ b/helix-term/src/ui/explorer.rs @@ -755,11 +755,7 @@ fn close_documents(current_item_path: PathBuf, cx: &mut Context) -> Result<()> { .documents .iter() .filter_map(|(id, doc)| { - if doc - .path() - .map(|p| p.starts_with(¤t_item_path)) - .unwrap_or(false) - { + if doc.path()?.starts_with(¤t_item_path) { Some(*id) } else { None