From 159150b24a4b01c0a65479139c45fc115351d0ff Mon Sep 17 00:00:00 2001 From: gibbz00 Date: Wed, 15 Feb 2023 13:17:22 +0100 Subject: [PATCH] replace custom join with vec::join --- helix-term/src/commands.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 1d98bdee9041..4d9091e3e958 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -2605,7 +2605,7 @@ impl ui::menu::Item for MappableCommand { ]; match command_list.get(name as &String) { Some(key_events) => { - row[1] = Cell::from(format_key_events(key_events)); + row[1] = Cell::from(key_events.join(", ")); } None => {} } @@ -2619,25 +2619,13 @@ impl ui::menu::Item for MappableCommand { let mut row: Vec = vec![Cell::from(*name), Cell::from(""), Cell::from(*doc)]; match command_list.get(*name) { Some(key_events) => { - row[1] = Cell::from(format_key_events(key_events)); + row[1] = Cell::from(key_events.join(", ")); } None => {} } return Row::new(row); } } - - // TODO: Generalize into a Vec Display implemention? - fn format_key_events(key_events: &Vec) -> String { - let mut result_string: String = String::new(); - for key_event in key_events { - if !result_string.is_empty() { - result_string.push_str(", "); - } - result_string.push_str(key_event); - } - result_string - } } }