From f9a03d1b75514e6675dae4297d8936acc477061e Mon Sep 17 00:00:00 2001 From: Dylan Bulfin Date: Mon, 12 Dec 2022 11:03:24 -0500 Subject: [PATCH] Updated map creation logic --- helix-term/src/ui/editor.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 @@ pub fn render_bufferline(editor: &Editor, viewport: Rect, surface: &mut Surface) .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() {