Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
bin/ui: Simplify impl of ui::format::labels()
Matthias Beyer committed 5 months ago
commit 8aeffe61ff6abf8a9b0fb19a4947bfae21203141
parent f5af55472e4c3e5106021da296db4b8939a9fee6
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 {