optimization

Co-authored-by: Adam Perkowski <adas1per@protonmail.com>
This commit is contained in:
Nyx 2024-10-01 21:29:08 -04:00 committed by GitHub
parent 23f5d45307
commit fb527f6281
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,8 +27,10 @@ pub fn create_shortcut_list(
shortcuts: impl IntoIterator<Item = Shortcut>, shortcuts: impl IntoIterator<Item = Shortcut>,
render_width: u16, render_width: u16,
) -> Box<[Line<'static>]> { ) -> Box<[Line<'static>]> {
let hints = shortcuts.into_iter().collect::<Box<[Shortcut]>>(); let shortcut_spans: Vec<Vec<Span<'static>>> = shortcuts
let shortcut_spans: Vec<Vec<Span<'static>>> = hints.iter().map(|h| h.to_spans()).collect(); .into_iter()
.map(|h| h.to_spans())
.collect();
let max_shortcut_width = shortcut_spans let max_shortcut_width = shortcut_spans
.iter() .iter()