From 8aeffe61ff6abf8a9b0fb19a4947bfae21203141 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 17 Aug 2025 12:45:47 +0200 Subject: [PATCH] bin/ui: Simplify impl of ui::format::labels() Signed-off-by: Matthias Beyer --- bin/ui/format.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bin/ui/format.rs b/bin/ui/format.rs index d2afda18..bb418712 100644 --- a/bin/ui/format.rs +++ b/bin/ui/format.rs @@ -55,17 +55,11 @@ pub fn patch_state(state: &patch::State) -> (String, Color) { } pub fn labels(labels: &[Label]) -> String { - let mut output = String::new(); - let mut labels = labels.iter().peekable(); - - while let Some(label) = labels.next() { - output.push_str(&label.to_string()); - - if labels.peek().is_some() { - output.push_str(", "); - } - } - output + labels + .iter() + .map(|l| l.name()) + .collect::>() + .join(", ") } pub fn author(did: &Did, alias: &Option, is_you: bool) -> String {