From d38c4c5843ba7cf55b9426d89f626c5984ec9e7c Mon Sep 17 00:00:00 2001 From: sholderbach Date: Fri, 29 Mar 2024 00:39:33 +0100 Subject: [PATCH] Revert boxing of `Record` (#12252) --- .../src/completions/variable_completions.rs | 2 +- crates/nu-cmd-base/src/hook.rs | 2 +- .../src/dataframe/values/nu_dataframe/mod.rs | 2 +- .../nu-cmd-lang/src/core_commands/describe.rs | 4 ++-- crates/nu-cmd-lang/src/example_support.rs | 2 +- crates/nu-command/src/charting/histogram.rs | 2 +- .../nu-command/src/conversions/into/record.rs | 2 +- crates/nu-command/src/env/load_env.rs | 2 +- crates/nu-command/src/env/with_env.rs | 4 ++-- crates/nu-command/src/filters/default.rs | 2 +- crates/nu-command/src/filters/drop/column.rs | 2 +- crates/nu-command/src/filters/flatten.rs | 6 ++--- crates/nu-command/src/filters/sort.rs | 2 +- crates/nu-command/src/filters/values.rs | 2 +- crates/nu-command/src/formats/from/xml.rs | 2 +- crates/nu-command/src/formats/to/json.rs | 2 +- crates/nu-command/src/formats/to/nuon.rs | 2 +- crates/nu-command/src/formats/to/toml.rs | 2 +- crates/nu-command/src/formats/to/xml.rs | 4 ++-- crates/nu-command/src/formats/to/yaml.rs | 2 +- crates/nu-command/src/help/help_.rs | 2 +- crates/nu-command/src/math/utils.rs | 4 ++-- crates/nu-command/src/network/http/client.rs | 6 ++--- .../nu-command/src/network/url/build_query.rs | 2 +- crates/nu-command/src/viewers/table.rs | 2 +- crates/nu-engine/src/documentation.rs | 4 ++-- crates/nu-explore/src/nu_common/table.rs | 2 +- crates/nu-protocol/src/config/hooks.rs | 2 +- .../nu-protocol/src/engine/pattern_match.rs | 2 +- crates/nu-protocol/src/eval_base.rs | 2 +- crates/nu-protocol/src/value/from_value.rs | 2 +- crates/nu-protocol/src/value/mod.rs | 6 ++--- crates/nu-table/src/types/collapse.rs | 22 +++++++++---------- crates/nu-table/src/unstructured_table.rs | 2 +- 34 files changed, 54 insertions(+), 56 deletions(-) diff --git a/crates/nu-cli/src/completions/variable_completions.rs b/crates/nu-cli/src/completions/variable_completions.rs index 826e1e412ac34..81b93e4c978d0 100644 --- a/crates/nu-cli/src/completions/variable_completions.rs +++ b/crates/nu-cli/src/completions/variable_completions.rs @@ -317,7 +317,7 @@ fn recursive_value(val: Value, sublevels: Vec>) -> Value { let span = val.span(); match val { Value::Record { val, .. } => { - for item in *val { + for item in val { // Check if index matches with sublevel if item.0.as_bytes().to_vec() == next_sublevel { // If matches try to fetch recursively the next diff --git a/crates/nu-cmd-base/src/hook.rs b/crates/nu-cmd-base/src/hook.rs index e4dafdc997d36..0d7ebc48c5864 100644 --- a/crates/nu-cmd-base/src/hook.rs +++ b/crates/nu-cmd-base/src/hook.rs @@ -18,7 +18,7 @@ pub fn eval_env_change_hook( if let Some(hook) = env_change_hook { match hook { Value::Record { val, .. } => { - for (env_name, hook_value) in &*val { + for (env_name, hook_value) in &val { let before = engine_state .previous_env_vars .get(env_name) diff --git a/crates/nu-cmd-dataframe/src/dataframe/values/nu_dataframe/mod.rs b/crates/nu-cmd-dataframe/src/dataframe/values/nu_dataframe/mod.rs index 638fc543abe69..747d7e8ea8f08 100644 --- a/crates/nu-cmd-dataframe/src/dataframe/values/nu_dataframe/mod.rs +++ b/crates/nu-cmd-dataframe/src/dataframe/values/nu_dataframe/mod.rs @@ -163,7 +163,7 @@ impl NuDataFrame { conversion::insert_record(&mut column_values, record, &maybe_schema)? } Value::Record { val: record, .. } => { - conversion::insert_record(&mut column_values, *record, &maybe_schema)? + conversion::insert_record(&mut column_values, record, &maybe_schema)? } _ => { let key = "0".to_string(); diff --git a/crates/nu-cmd-lang/src/core_commands/describe.rs b/crates/nu-cmd-lang/src/core_commands/describe.rs index 46e6e9a91efe7..1b8ae89102c35 100644 --- a/crates/nu-cmd-lang/src/core_commands/describe.rs +++ b/crates/nu-cmd-lang/src/core_commands/describe.rs @@ -317,7 +317,7 @@ fn describe_value( record!( "type" => Value::string("record", head), "lazy" => Value::bool(false, head), - "columns" => Value::record(*val, head), + "columns" => Value::record(val, head), ), head, ) @@ -408,7 +408,7 @@ fn describe_value( )?); } - record.push("columns", Value::record(*val, head)); + record.push("columns", Value::record(val, head)); } else { let cols = val.column_names(); record.push("length", Value::int(cols.len() as i64, head)); diff --git a/crates/nu-cmd-lang/src/example_support.rs b/crates/nu-cmd-lang/src/example_support.rs index aa2cbb10cecb0..a9081070484b0 100644 --- a/crates/nu-cmd-lang/src/example_support.rs +++ b/crates/nu-cmd-lang/src/example_support.rs @@ -237,7 +237,7 @@ impl<'a> std::fmt::Debug for DebuggableValue<'a> { Value::Record { val, .. } => { write!(f, "{{")?; let mut first = true; - for (col, value) in (&**val).into_iter() { + for (col, value) in val.into_iter() { if !first { write!(f, ", ")?; } diff --git a/crates/nu-command/src/charting/histogram.rs b/crates/nu-command/src/charting/histogram.rs index bd94af2ed3ae4..88fe6d4c6cb0c 100755 --- a/crates/nu-command/src/charting/histogram.rs +++ b/crates/nu-command/src/charting/histogram.rs @@ -177,7 +177,7 @@ fn run_histogram( match v { // parse record, and fill valid value to actual input. Value::Record { val, .. } => { - for (c, v) in *val { + for (c, v) in val { if &c == col_name { if let Ok(v) = HashableValue::from_value(v, head_span) { inputs.push(v); diff --git a/crates/nu-command/src/conversions/into/record.rs b/crates/nu-command/src/conversions/into/record.rs index e0d3516654962..7cd5a7a56b605 100644 --- a/crates/nu-command/src/conversions/into/record.rs +++ b/crates/nu-command/src/conversions/into/record.rs @@ -131,7 +131,7 @@ fn into_record( .collect(), span, ), - Value::Record { val, .. } => Value::record(*val, span), + Value::Record { val, .. } => Value::record(val, span), Value::Error { .. } => input, other => Value::error( ShellError::TypeMismatch { diff --git a/crates/nu-command/src/env/load_env.rs b/crates/nu-command/src/env/load_env.rs index 0eba17528f47e..dceaaa9d09cdd 100644 --- a/crates/nu-command/src/env/load_env.rs +++ b/crates/nu-command/src/env/load_env.rs @@ -53,7 +53,7 @@ impl Command for LoadEnv { } None => match input { PipelineData::Value(Value::Record { val, .. }, ..) => { - for (env_var, rhs) in *val { + for (env_var, rhs) in val { let env_var_ = env_var.as_str(); if ["FILE_PWD", "CURRENT_FILE"].contains(&env_var_) { return Err(ShellError::AutomaticEnvVarSetManually { diff --git a/crates/nu-command/src/env/with_env.rs b/crates/nu-command/src/env/with_env.rs index 5bd675e84a659..446da0a7b4663 100644 --- a/crates/nu-command/src/env/with_env.rs +++ b/crates/nu-command/src/env/with_env.rs @@ -89,7 +89,7 @@ fn with_env( // single row([[X W]; [Y Z]]) match &table[0] { Value::Record { val, .. } => { - for (k, v) in &**val { + for (k, v) in val { env.insert(k.to_string(), v.clone()); } } @@ -117,7 +117,7 @@ fn with_env( } // when get object by `open x.json` or `from json` Value::Record { val, .. } => { - for (k, v) in &**val { + for (k, v) in val { env.insert(k.clone(), v.clone()); } } diff --git a/crates/nu-command/src/filters/default.rs b/crates/nu-command/src/filters/default.rs index 30619d0f26f4a..f5a1b70aca8ad 100644 --- a/crates/nu-command/src/filters/default.rs +++ b/crates/nu-command/src/filters/default.rs @@ -106,7 +106,7 @@ fn default( record.push(column.item.clone(), value.clone()); } - Value::record(*record, span) + Value::record(record, span) } _ => item, } diff --git a/crates/nu-command/src/filters/drop/column.rs b/crates/nu-command/src/filters/drop/column.rs index 1862ac51c36d0..c21484a498674 100644 --- a/crates/nu-command/src/filters/drop/column.rs +++ b/crates/nu-command/src/filters/drop/column.rs @@ -123,7 +123,7 @@ fn drop_cols( } => { let len = record.len().saturating_sub(columns); record.truncate(len); - Ok(Value::record(*record, span).into_pipeline_data_with_metadata(metadata)) + Ok(Value::record(record, span).into_pipeline_data_with_metadata(metadata)) } // Propagate errors Value::Error { error, .. } => Err(*error), diff --git a/crates/nu-command/src/filters/flatten.rs b/crates/nu-command/src/filters/flatten.rs index f7f5a1325b79e..b2ceba3b55cbe 100644 --- a/crates/nu-command/src/filters/flatten.rs +++ b/crates/nu-command/src/filters/flatten.rs @@ -164,7 +164,7 @@ fn flat_value(columns: &[CellPath], item: Value, all: bool) -> Vec { match value { Value::Record { val, .. } => { if need_flatten { - for (col, val) in *val { + for (col, val) in val { if out.contains_key(&col) { out.insert(format!("{column}_{col}"), val); } else { @@ -172,9 +172,9 @@ fn flat_value(columns: &[CellPath], item: Value, all: bool) -> Vec { } } } else if out.contains_key(&column) { - out.insert(format!("{column}_{column}"), Value::record(*val, span)); + out.insert(format!("{column}_{column}"), Value::record(val, span)); } else { - out.insert(column, Value::record(*val, span)); + out.insert(column, Value::record(val, span)); } } Value::List { vals, .. } => { diff --git a/crates/nu-command/src/filters/sort.rs b/crates/nu-command/src/filters/sort.rs index cd0818a8c959f..8e9ee3f4f2c30 100644 --- a/crates/nu-command/src/filters/sort.rs +++ b/crates/nu-command/src/filters/sort.rs @@ -144,7 +144,7 @@ impl Command for Sort { // Records have two sorting methods, toggled by presence or absence of -v PipelineData::Value(Value::Record { val, .. }, ..) => { let sort_by_value = call.has_flag(engine_state, stack, "values")?; - let record = sort_record(*val, span, sort_by_value, reverse, insensitive, natural); + let record = sort_record(val, span, sort_by_value, reverse, insensitive, natural); Ok(record.into_pipeline_data()) } // Other values are sorted here diff --git a/crates/nu-command/src/filters/values.rs b/crates/nu-command/src/filters/values.rs index 640ef1bb44b0a..9147bfb0e84c2 100644 --- a/crates/nu-command/src/filters/values.rs +++ b/crates/nu-command/src/filters/values.rs @@ -106,7 +106,7 @@ pub fn get_values<'a>( for item in input { match item { Value::Record { val, .. } => { - for (k, v) in &**val { + for (k, v) in val { if let Some(vec) = output.get_mut(k) { vec.push(v.clone()); } else { diff --git a/crates/nu-command/src/formats/from/xml.rs b/crates/nu-command/src/formats/from/xml.rs index 3443bf0309467..bdb36e3769964 100644 --- a/crates/nu-command/src/formats/from/xml.rs +++ b/crates/nu-command/src/formats/from/xml.rs @@ -412,7 +412,7 @@ mod tests { content_tag( "nu", indexmap! {}, - &[ + &vec![ content_tag("dev", indexmap! {}, &[content_string("Andrés")]), content_tag("dev", indexmap! {}, &[content_string("JT")]), content_tag("dev", indexmap! {}, &[content_string("Yehuda")]) diff --git a/crates/nu-command/src/formats/to/json.rs b/crates/nu-command/src/formats/to/json.rs index 31ed623ab9005..9c6b5db904a3a 100644 --- a/crates/nu-command/src/formats/to/json.rs +++ b/crates/nu-command/src/formats/to/json.rs @@ -130,7 +130,7 @@ pub fn value_to_json_value(v: &Value) -> Result { } Value::Record { val, .. } => { let mut m = nu_json::Map::new(); - for (k, v) in &**val { + for (k, v) in val { m.insert(k.clone(), value_to_json_value(v)?); } nu_json::Value::Object(m) diff --git a/crates/nu-command/src/formats/to/nuon.rs b/crates/nu-command/src/formats/to/nuon.rs index 84b237e52ec6c..499fd027872a8 100644 --- a/crates/nu-command/src/formats/to/nuon.rs +++ b/crates/nu-command/src/formats/to/nuon.rs @@ -246,7 +246,7 @@ pub fn value_to_string( )), Value::Record { val, .. } => { let mut collection = vec![]; - for (col, val) in &**val { + for (col, val) in val { collection.push(if needs_quotes(col) { format!( "{idt_po}\"{}\": {}", diff --git a/crates/nu-command/src/formats/to/toml.rs b/crates/nu-command/src/formats/to/toml.rs index 383fcda95ab87..014f3ab350276 100644 --- a/crates/nu-command/src/formats/to/toml.rs +++ b/crates/nu-command/src/formats/to/toml.rs @@ -57,7 +57,7 @@ fn helper(engine_state: &EngineState, v: &Value) -> Result toml::Value::String(val.clone()), Value::Record { val, .. } => { let mut m = toml::map::Map::new(); - for (k, v) in &**val { + for (k, v) in val { m.insert(k.clone(), helper(engine_state, v)?); } toml::Value::Table(m) diff --git a/crates/nu-command/src/formats/to/xml.rs b/crates/nu-command/src/formats/to/xml.rs index c5b1238714ea8..32e9ef4732905 100644 --- a/crates/nu-command/src/formats/to/xml.rs +++ b/crates/nu-command/src/formats/to/xml.rs @@ -326,7 +326,7 @@ impl Job { // content: null}, {tag: a}. See to_xml_entry for more let attrs = match attrs { Value::Record { val, .. } => val, - Value::Nothing { .. } => Box::new(Record::new()), + Value::Nothing { .. } => Record::new(), _ => { return Err(ShellError::CantConvert { to_type: "XML".into(), @@ -350,7 +350,7 @@ impl Job { } }; - self.write_tag(entry_span, tag, tag_span, *attrs, content) + self.write_tag(entry_span, tag, tag_span, attrs, content) } } diff --git a/crates/nu-command/src/formats/to/yaml.rs b/crates/nu-command/src/formats/to/yaml.rs index aa67f93c2b3a0..df25b4a6af4d4 100644 --- a/crates/nu-command/src/formats/to/yaml.rs +++ b/crates/nu-command/src/formats/to/yaml.rs @@ -54,7 +54,7 @@ pub fn value_to_yaml_value(v: &Value) -> Result { } Value::Record { val, .. } => { let mut m = serde_yaml::Mapping::new(); - for (k, v) in &**val { + for (k, v) in val { m.insert( serde_yaml::Value::String(k.clone()), value_to_yaml_value(v)?, diff --git a/crates/nu-command/src/help/help_.rs b/crates/nu-command/src/help/help_.rs index 47f268c5c2280..4aa6b4b6b354a 100644 --- a/crates/nu-command/src/help/help_.rs +++ b/crates/nu-command/src/help/help_.rs @@ -180,7 +180,7 @@ pub fn highlight_search_in_table( )?; if has_match { - matches.push(Value::record(*record, record_span)); + matches.push(Value::record(record, record_span)); } } diff --git a/crates/nu-command/src/math/utils.rs b/crates/nu-command/src/math/utils.rs index 37c4bd1c0e31b..8a24100415117 100644 --- a/crates/nu-command/src/math/utils.rs +++ b/crates/nu-command/src/math/utils.rs @@ -27,7 +27,7 @@ fn helper_for_tables( for val in values { match val { Value::Record { val, .. } => { - for (key, value) in &**val { + for (key, value) in val { column_values .entry(key.clone()) .and_modify(|v: &mut Vec| v.push(value.clone())) @@ -88,7 +88,7 @@ pub fn calculate( *val = mf(slice::from_ref(val), span, name)?; Ok(()) })?; - Ok(Value::record(*record, span)) + Ok(Value::record(record, span)) } PipelineData::Value(Value::Range { val, .. }, ..) => { let new_vals: Result, ShellError> = val diff --git a/crates/nu-command/src/network/http/client.rs b/crates/nu-command/src/network/http/client.rs index 61ada986c75a6..91c8e947eb177 100644 --- a/crates/nu-command/src/network/http/client.rs +++ b/crates/nu-command/src/network/http/client.rs @@ -222,7 +222,7 @@ pub fn send_request( Value::Record { val, .. } if body_type == BodyType::Form => { let mut data: Vec<(String, String)> = Vec::with_capacity(val.len()); - for (col, val) in *val { + for (col, val) in val { data.push((col, val.coerce_into_string()?)) } @@ -336,7 +336,7 @@ pub fn request_add_custom_headers( match &headers { Value::Record { val, .. } => { - for (k, v) in &**val { + for (k, v) in val { custom_headers.insert(k.to_string(), v.clone()); } } @@ -346,7 +346,7 @@ pub fn request_add_custom_headers( // single row([key1 key2]; [val1 val2]) match &table[0] { Value::Record { val, .. } => { - for (k, v) in &**val { + for (k, v) in val { custom_headers.insert(k.to_string(), v.clone()); } } diff --git a/crates/nu-command/src/network/url/build_query.rs b/crates/nu-command/src/network/url/build_query.rs index 92b5057b6082d..27be1b2748e1f 100644 --- a/crates/nu-command/src/network/url/build_query.rs +++ b/crates/nu-command/src/network/url/build_query.rs @@ -65,7 +65,7 @@ fn to_url(input: PipelineData, head: Span) -> Result { match value { Value::Record { ref val, .. } => { let mut row_vec = vec![]; - for (k, v) in &**val { + for (k, v) in val { match v.coerce_string() { Ok(s) => { row_vec.push((k.clone(), s)); diff --git a/crates/nu-command/src/viewers/table.rs b/crates/nu-command/src/viewers/table.rs index 4b97813906e36..3afa8193b0656 100644 --- a/crates/nu-command/src/viewers/table.rs +++ b/crates/nu-command/src/viewers/table.rs @@ -392,7 +392,7 @@ fn handle_table_command( } PipelineData::Value(Value::Record { val, .. }, ..) => { input.data = PipelineData::Empty; - handle_record(input, cfg, *val) + handle_record(input, cfg, val) } PipelineData::Value(Value::LazyRecord { val, .. }, ..) => { input.data = val.collect()?.into_pipeline_data(); diff --git a/crates/nu-engine/src/documentation.rs b/crates/nu-engine/src/documentation.rs index 463f8f10e77b7..3f60d0bfac624 100644 --- a/crates/nu-engine/src/documentation.rs +++ b/crates/nu-engine/src/documentation.rs @@ -376,8 +376,8 @@ fn get_argument_for_color_value( ) -> Option { match color { Value::Record { val, .. } => { - let record_exp: Vec = (**val) - .iter() + let record_exp: Vec = val + .into_iter() .map(|(k, v)| { RecordItem::Pair( Expression { diff --git a/crates/nu-explore/src/nu_common/table.rs b/crates/nu-explore/src/nu_common/table.rs index b1d0a4c974199..6c7ed9a4cae41 100644 --- a/crates/nu-explore/src/nu_common/table.rs +++ b/crates/nu-explore/src/nu_common/table.rs @@ -16,7 +16,7 @@ pub fn try_build_table( let span = value.span(); match value { Value::List { vals, .. } => try_build_list(vals, ctrlc, config, span, style_computer), - Value::Record { val, .. } => try_build_map(*val, span, style_computer, ctrlc, config), + Value::Record { val, .. } => try_build_map(val, span, style_computer, ctrlc, config), val if matches!(val, Value::String { .. }) => { nu_value_to_string_clean(&val, config, style_computer).0 } diff --git a/crates/nu-protocol/src/config/hooks.rs b/crates/nu-protocol/src/config/hooks.rs index 88f5f4abf1a42..cabd0cb15422b 100644 --- a/crates/nu-protocol/src/config/hooks.rs +++ b/crates/nu-protocol/src/config/hooks.rs @@ -39,7 +39,7 @@ pub(super) fn create_hooks(value: &Value) -> Result { Value::Record { val, .. } => { let mut hooks = Hooks::new(); - for (col, val) in &**val { + for (col, val) in val { match col.as_str() { "pre_prompt" => hooks.pre_prompt = Some(val.clone()), "pre_execution" => hooks.pre_execution = Some(val.clone()), diff --git a/crates/nu-protocol/src/engine/pattern_match.rs b/crates/nu-protocol/src/engine/pattern_match.rs index e29779b6336fb..8c1266c1b5320 100644 --- a/crates/nu-protocol/src/engine/pattern_match.rs +++ b/crates/nu-protocol/src/engine/pattern_match.rs @@ -23,7 +23,7 @@ impl Matcher for Pattern { Pattern::Record(field_patterns) => match value { Value::Record { val, .. } => { 'top: for field_pattern in field_patterns { - for (col, val) in &**val { + for (col, val) in val { if col == &field_pattern.0 { // We have found the field let result = field_pattern.1.match_value(val, matches); diff --git a/crates/nu-protocol/src/eval_base.rs b/crates/nu-protocol/src/eval_base.rs index 01955217f1b9a..e0988b5f614ef 100644 --- a/crates/nu-protocol/src/eval_base.rs +++ b/crates/nu-protocol/src/eval_base.rs @@ -75,7 +75,7 @@ pub trait Eval { RecordItem::Spread(_, inner) => { match Self::eval::(state, mut_state, inner)? { Value::Record { val: inner_val, .. } => { - for (col_name, val) in *inner_val { + for (col_name, val) in inner_val { if let Some(orig_span) = col_names.get(&col_name) { return Err(ShellError::ColumnDefinedTwice { col_name, diff --git a/crates/nu-protocol/src/value/from_value.rs b/crates/nu-protocol/src/value/from_value.rs index baa77ad7eabf0..7192b5fb3d589 100644 --- a/crates/nu-protocol/src/value/from_value.rs +++ b/crates/nu-protocol/src/value/from_value.rs @@ -538,7 +538,7 @@ impl FromValue for Vec { impl FromValue for Record { fn from_value(v: Value) -> Result { match v { - Value::Record { val, .. } => Ok(*val), + Value::Record { val, .. } => Ok(val), v => Err(ShellError::CantConvert { to_type: "Record".into(), from_type: v.get_type().to_string(), diff --git a/crates/nu-protocol/src/value/mod.rs b/crates/nu-protocol/src/value/mod.rs index 473221a721e9c..929dca5198261 100644 --- a/crates/nu-protocol/src/value/mod.rs +++ b/crates/nu-protocol/src/value/mod.rs @@ -109,7 +109,7 @@ pub enum Value { internal_span: Span, }, Record { - val: Box, + val: Record, // note: spans are being refactored out of Value // please use .span() instead of matching this span value #[serde(rename = "span")] @@ -537,7 +537,7 @@ impl Value { /// Unwraps the inner [`Record`] value or returns an error if this `Value` is not a record pub fn into_record(self) -> Result { if let Value::Record { val, .. } = self { - Ok(*val) + Ok(val) } else { self.cant_convert_to("record") } @@ -1997,7 +1997,7 @@ impl Value { pub fn record(val: Record, span: Span) -> Value { Value::Record { - val: Box::new(val), + val, internal_span: span, } } diff --git a/crates/nu-table/src/types/collapse.rs b/crates/nu-table/src/types/collapse.rs index d4d43e86a9241..fd4e354222e71 100644 --- a/crates/nu-table/src/types/collapse.rs +++ b/crates/nu-table/src/types/collapse.rs @@ -48,19 +48,17 @@ fn colorize_value(value: &mut Value, config: &Config, style_computer: &StyleComp // Take ownership of the record and reassign to &mut // We do this to have owned keys through `.into_iter` let record = std::mem::take(val); - *val = Box::new( - record - .into_iter() - .map(|(mut header, mut val)| { - colorize_value(&mut val, config, style_computer); + *val = record + .into_iter() + .map(|(mut header, mut val)| { + colorize_value(&mut val, config, style_computer); - if let Some(color) = style.color_style { - header = color.paint(header).to_string(); - } - (header, val) - }) - .collect::(), - ); + if let Some(color) = style.color_style { + header = color.paint(header).to_string(); + } + (header, val) + }) + .collect::(); } Value::List { vals, .. } => { for val in vals { diff --git a/crates/nu-table/src/unstructured_table.rs b/crates/nu-table/src/unstructured_table.rs index 58ea117791e1d..21753f795aee5 100644 --- a/crates/nu-table/src/unstructured_table.rs +++ b/crates/nu-table/src/unstructured_table.rs @@ -89,7 +89,7 @@ fn build_table( fn convert_nu_value_to_table_value(value: Value, config: &Config) -> TableValue { match value { - Value::Record { val, .. } => build_vertical_map(*val, config), + Value::Record { val, .. } => build_vertical_map(val, config), Value::List { vals, .. } => { let rebuild_array_as_map = is_valid_record(&vals) && count_columns_in_record(&vals) > 0; if rebuild_array_as_map {