From: Scott Worley Date: Sat, 24 Aug 2024 09:32:59 +0000 (-0700) Subject: Refactor: Collect to Vec and join(" ") X-Git-Tag: v0.3.0~21 X-Git-Url: http://git.scottworley.com/tablify/commitdiff_plain/54b1f74ff185bceca625df43ecfd0148d181b34c?hp=b8b365ce67492e37b42b3bc088bd04158b0065eb Refactor: Collect to Vec and join(" ") --- diff --git a/src/lib.rs b/src/lib.rs index c261c78..e636bb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -150,8 +150,8 @@ fn column_order(rows: &[RowInput]) -> Vec { fn render_instance(entry: &Entry) -> String { match &entry.instance { - None => String::from("✓ "), - Some(instance) => String::from(instance) + " ", + None => String::from("✓"), + Some(instance) => String::from(instance), } } @@ -169,9 +169,10 @@ fn render_cell(col: &str, row: &RowInput) -> String { entries .iter() .map(|i| render_instance(i)) - .collect::() + .collect::>() + .join(" ") }; - format!("{}", contents.trim()) + format!("{contents}") } fn render_row(columns: &[String], row: &RowInput) -> String {