From: Scott Worley Date: Mon, 19 Aug 2024 20:56:55 +0000 (-0700) Subject: Clippy wants this to use mut and write! X-Git-Tag: v0.2.0~4 X-Git-Url: http://git.scottworley.com/tablify/commitdiff_plain/7067975b593ef6a8b639f61dda710b023ec26a25?ds=sidebyside Clippy wants this to use mut and write! --- diff --git a/src/lib.rs b/src/lib.rs index 5de1c12..a3878c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,5 @@ use std::collections::{HashMap, HashSet}; +use std::fmt::Write; use std::io::BufRead; use std::iter::Iterator; @@ -190,10 +191,10 @@ fn render_row(columns: &[String], row: &RowInput) -> String { fn render_column_headers(columns: &[String]) -> String { // TODO: Escape HTML special characters String::from("") - + &columns - .iter() - .map(|c| format!("{c}")) - .collect::() + + &columns.iter().fold(String::new(), |mut acc, c| { + write!(&mut acc, "{c}").unwrap(); + acc + }) + "\n" }