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
.iter()
.filter_map(|(id, doc)| {
if doc
.path()
.map(|p| p.starts_with(&current_item_path))
.unwrap_or(false)
{
if doc.path()?.starts_with(&current_item_path) {
Some(*id)
} else {
None

Loading…
Cancel
Save