From b2837ff3bea286ce7ccfba9b6fbcd861977caf83 Mon Sep 17 00:00:00 2001 From: Gokul Soumya Date: Sat, 24 Dec 2022 16:51:38 +0530 Subject: Minimize allocation when converting table rows to string --- helix-term/src/ui/picker.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'helix-term/src') diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs index e00fe1f8..05738ccf 100644 --- a/helix-term/src/ui/picker.rs +++ b/helix-term/src/ui/picker.rs @@ -733,7 +733,11 @@ impl Component for Picker { .map(|mut row| { const TEMP_CELL_SEP: &str = " "; - let line = row.cell_text().join(TEMP_CELL_SEP); + let line = row.cell_text().fold(String::new(), |mut s, frag| { + s.push_str(&frag); + s.push_str(TEMP_CELL_SEP); + s + }); // Items are filtered by using the text returned by menu::Item::filter_text // but we do highlighting here using the text in Row and therefore there -- cgit v1.2.3-70-g09d2