diff --git a/crates/nu-table/src/types/collapse.rs b/crates/nu-table/src/types/collapse.rs index 9bc01742a0..4b4ebed172 100644 --- a/crates/nu-table/src/types/collapse.rs +++ b/crates/nu-table/src/types/collapse.rs @@ -1,6 +1,6 @@ use nu_ansi_term::Style; use nu_color_config::StyleComputer; -use nu_protocol::{Config, Record, Value}; +use nu_protocol::{Config, Value}; use nu_utils::SharedCow; use crate::{ @@ -51,7 +51,7 @@ fn colorize_value(value: &mut Value, config: &Config, style_computer: &StyleComp (header, val) }) - .collect::(), + .collect(), ); } Value::List { vals, .. } => { diff --git a/crates/nu-table/src/unstructured_table.rs b/crates/nu-table/src/unstructured_table.rs index 53e67e16c2..be722c5e51 100644 --- a/crates/nu-table/src/unstructured_table.rs +++ b/crates/nu-table/src/unstructured_table.rs @@ -60,10 +60,7 @@ fn build_table( DimensionPriority::Last, )); - // color_config closures for "separator" are just given a null. - let color = style.compute("separator", &Value::nothing(Span::unknown())); - let color = color.paint(" ").to_string(); - if let Ok(color) = Color::try_from(color) { + if let Some(color) = get_border_color(style) { if !is_color_empty(&color) { return build_table_with_border_color(table, color); } @@ -348,3 +345,11 @@ impl TableOption for SetBorderColor { cfg.set_borders_color(borders); } } + +fn get_border_color(style: &StyleComputer<'_>) -> Option { + // color_config closures for "separator" are just given a null. + let color = style.compute("separator", &Value::nothing(Span::unknown())); + let color = color.paint(" ").to_string(); + let color = Color::try_from(color); + color.ok() +}