diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 7e3b0681f..8b6ac255c 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -683,11 +683,7 @@ impl EditorView { .to_str() .unwrap_or_default(); - if names_map.contains_key(fname) { - names_map.insert(fname, names_map.get(fname).unwrap() + 1); - } else { - names_map.insert(fname, 1); - } + *names_map.entry(fname).or_insert(0) += 1; } for doc in editor.documents() {