From dc38e3e10ef68c9a794c5f0269fc7d65e53ffe21 Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Sat, 12 Oct 2024 09:45:22 -0700 Subject: [PATCH] refactor: Improve code formatting --- tui/src/hint.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tui/src/hint.rs b/tui/src/hint.rs index 8e16e749..33cf62c8 100644 --- a/tui/src/hint.rs +++ b/tui/src/hint.rs @@ -59,9 +59,9 @@ pub fn create_shortcut_list( if rest.is_empty() { break; - } else { - shortcut_spans = rest; } + + shortcut_spans = rest; } lines.into_boxed_slice() @@ -79,8 +79,8 @@ impl Shortcut { } fn to_spans(&self) -> Vec> { - let mut ret: Vec<_> = self - .key_sequences + let description = Span::styled(self.desc, Style::default().italic()); + self.key_sequences .iter() .flat_map(|seq| { [ @@ -89,8 +89,7 @@ impl Shortcut { Span::default().content("] "), ] }) - .collect(); - ret.push(Span::styled(self.desc, Style::default().italic())); - ret + .chain(std::iter::once(description)) + .collect() } }