@@ -11,7 +11,7 @@ fn term_width() -> usize {
1111 . unwrap_or ( 120 )
1212}
1313
14- fn style_table ( table : & mut tabled:: Table , _ncols : usize ) {
14+ fn style_table ( table : & mut tabled:: Table ) {
1515 let tw = term_width ( ) ;
1616
1717 table
@@ -23,22 +23,20 @@ fn style_table(table: &mut tabled::Table, _ncols: usize) {
2323
2424/// Print a table with string data. Headers are &str slices, rows are Vec<String>.
2525pub fn print ( headers : & [ & str ] , rows : & [ Vec < String > ] ) {
26- let ncols = headers. len ( ) ;
2726 let mut builder = tabled:: builder:: Builder :: new ( ) ;
2827 builder. push_record ( headers. iter ( ) . map ( |h| h. to_string ( ) ) ) ;
2928 for row in rows {
3029 builder. push_record ( row. iter ( ) . map ( |c| c. to_string ( ) ) ) ;
3130 }
3231 let mut table = builder. build ( ) ;
33- style_table ( & mut table, ncols ) ;
32+ style_table ( & mut table) ;
3433 println ! ( "{table}" ) ;
3534}
3635
3736/// Print a table with JSON-typed data. Numbers, bools, and nulls get per-cell coloring.
3837pub fn print_json ( headers : & [ String ] , rows : & [ Vec < serde_json:: Value > ] ) {
3938 use tabled:: settings:: object:: Cell ;
4039
41- let ncols = headers. len ( ) ;
4240 let mut builder = tabled:: builder:: Builder :: new ( ) ;
4341 builder. push_record ( headers. iter ( ) . map ( |h| h. to_string ( ) ) ) ;
4442
@@ -71,7 +69,7 @@ pub fn print_json(headers: &[String], rows: &[Vec<serde_json::Value>]) {
7169 }
7270
7371 let mut table = builder. build ( ) ;
74- style_table ( & mut table, ncols ) ;
72+ style_table ( & mut table) ;
7573
7674 for ( r, c, color) in colored_cells {
7775 table. with ( Modify :: new ( Cell :: new ( r, c) ) . with ( color) ) ;
0 commit comments