]> git.scottworley.com Git - tablify/blobdiff - src/lib.rs
Rename render_instance → render_one_instance
[tablify] / src / lib.rs
index 47e1d3a9eb1fa10fac60a16cf66153b55d5d725f..f1da5f7270cb2a285df10bbffca9ba1da061c720 100644 (file)
@@ -187,7 +187,7 @@ fn column_order(rows: &[Row]) -> Vec<String> {
         .collect()
 }
 
-fn render_instance(instance: &Option<String>) -> HTML {
+fn render_one_instance(instance: &Option<String>) -> HTML {
     match instance {
         None => HTML::from("✓"),
         Some(instance) => HTML::escape(instance.as_ref()),
@@ -212,7 +212,7 @@ fn render_cell(col: &str, row: &mut Row) -> HTML {
             instances
                 .unwrap()
                 .iter()
-                .map(render_instance)
+                .map(render_one_instance)
                 .map(|html| html.0) // Waiting for slice_concat_trait to stabilize
                 .collect::<Vec<_>>()
                 .join(" "),
@@ -226,12 +226,12 @@ fn render_cell(col: &str, row: &mut Row) -> HTML {
 
 fn render_row(columns: &[String], row: &mut Row) -> HTML {
     let row_label = HTML::escape(row.label.as_ref());
+    let cells = columns
+        .iter()
+        .map(|col| render_cell(col, row))
+        .collect::<HTML>();
     HTML(format!(
-        "<tr><th id=\"{row_label}\">{row_label}</th>{}</tr>\n",
-        &columns
-            .iter()
-            .map(|col| render_cell(col, row))
-            .collect::<HTML>()
+        "<tr><th id=\"{row_label}\">{row_label}</th>{cells}</tr>\n"
     ))
 }