Refactoring.

This commit is contained in:
Gerrit Viljoen 2019-05-14 16:15:22 +02:00
parent 757d932ac0
commit 44544db47e

View File

@ -89,7 +89,7 @@ fn format_table_inner(data: Vec<Vec<String>>, conf: &TableConfig) -> String {
result result
} }
fn valid(data: &Vec<Vec<String>>, conf: &TableConfig) -> bool { fn valid(data: &[Vec<String>], conf: &TableConfig) -> bool {
if data.len() == 0 { if data.len() == 0 {
false false
} else if conf.width < 4 { } else if conf.width < 4 {
@ -149,7 +149,7 @@ fn truncate_widths(mut widths: Vec<u32>, conf: &TableConfig) -> Vec<u32> {
widths widths
} }
fn format_line(row: &Vec<String>, head: &str, delim: &str, tail: &str) -> String { fn format_line(row: &[String], head: &str, delim: &str, tail: &str) -> String {
let mut result = String::new(); let mut result = String::new();
result.push_str(head); result.push_str(head);
for cell in row { for cell in row {