Radish alpha
r
rad:z39mP9rQAaGmERfUMPULfPUi473tY
Radicle terminal user interface
Radicle
Git
bin/ui: Simplify impl of ui::format::labels()
Matthias Beyer committed 4 months ago
commit 8aeffe61ff6abf8a9b0fb19a4947bfae21203141
parent f5af554
1 file changed +5 -11
modified 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::<Vec<_>>()
+
        .join(", ")
}

pub fn author(did: &Did, alias: &Option<Alias>, is_you: bool) -> String {