From 7067975b593ef6a8b639f61dda710b023ec26a25 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Mon, 19 Aug 2024 13:56:55 -0700 Subject: [PATCH] Clippy wants this to use mut and write! --- src/lib.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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" } -- 2.44.1