refactor(ui/explorer/close_documents): concise code

Resolve https://github.com/helix-editor/helix/pull/5768#discussion_r1133065427
pull/9/head
wongjiahau 2 years ago
parent 178086767f
commit 9a1aff25bd

@ -755,11 +755,7 @@ fn close_documents(current_item_path: PathBuf, cx: &mut Context) -> Result<()> {
.documents .documents
.iter() .iter()
.filter_map(|(id, doc)| { .filter_map(|(id, doc)| {
if doc if doc.path()?.starts_with(&current_item_path) {
.path()
.map(|p| p.starts_with(&current_item_path))
.unwrap_or(false)
{
Some(*id) Some(*id)
} else { } else {
None None

Loading…
Cancel
Save