diff --git a/src/export/markdown.rs b/src/export/markdown.rs index 59b9cf8..c85401e 100644 --- a/src/export/markdown.rs +++ b/src/export/markdown.rs @@ -4,7 +4,7 @@ use crate::export::markup::MarkupExporter; pub struct MarkdownExporter {} impl MarkupExporter for MarkdownExporter { - fn table_data(&self, data: &[&str]) -> String { + fn table_row(&self, data: &[&str]) -> String { format!("| {} |\n", data.join(" | ")) } @@ -21,9 +21,8 @@ impl MarkupExporter for MarkdownExporter { #[test] fn test_markdown_formatter_table_data() { let formatter = MarkdownExporter::default(); - let data = vec!["a", "b", "c"]; - let actual = formatter.table_data(&data); + let actual = formatter.table_row(&["a", "b", "c"]); let expect = "| a | b | c |\n"; assert_eq!(expect, actual); diff --git a/src/export/markup.rs b/src/export/markup.rs index 1a04216..8f6e1c4 100644 --- a/src/export/markup.rs +++ b/src/export/markup.rs @@ -19,7 +19,7 @@ pub trait MarkupExporter { ]; // emit header - let mut table = self.table_data(&head); + let mut table = self.table_row(&head); // emit horizontal line table.push_str(&self.table_line(head.len())); @@ -44,21 +44,21 @@ pub trait MarkupExporter { } else { "".into() }; + // prepare table row entries - let data: [&str; 5] = [ + table.push_str(&self.table_row(&[ &self.command(&cmd_str), &format!("{}{}", mean_str, stddev_str), &min_str, &max_str, &format!("{}{}", rel_str, rel_stddev_str), - ]; - table.push_str(&self.table_data(&data)) + ])) } table } - fn table_data(&self, data: &[&str]) -> String; + fn table_row(&self, data: &[&str]) -> String; fn table_line(&self, size: usize) -> String;