Fix compile errors

This commit is contained in:
Ian Manske 2024-04-22 17:50:31 -04:00
parent 16c8c6cd7d
commit 7e38cc0363
51 changed files with 114 additions and 144 deletions

View File

@ -18,7 +18,7 @@ pub fn eval_env_change_hook(
if let Some(hook) = env_change_hook { if let Some(hook) = env_change_hook {
match hook { match hook {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (env_name, hook_value) in &*val { for (env_name, hook_value) in &val {
let before = engine_state let before = engine_state
.previous_env_vars .previous_env_vars
.get(env_name) .get(env_name)

View File

@ -58,7 +58,7 @@ fn horizontal_rotate_value(
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
let rotations = by.map(|n| n % record.len()).unwrap_or(1); let rotations = by.map(|n| n % record.len()).unwrap_or(1);
let (mut cols, mut vals): (Vec<_>, Vec<_>) = record.into_owned().into_iter().unzip(); let (mut cols, mut vals): (Vec<_>, Vec<_>) = record.into_iter().unzip();
if !cells_only { if !cells_only {
match direction { match direction {
HorizontalDirection::Right => cols.rotate_right(rotations), HorizontalDirection::Right => cols.rotate_right(rotations),

View File

@ -171,7 +171,7 @@ pub fn rotate(
let span = val.span(); let span = val.span();
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
let (cols, vals): (Vec<_>, Vec<_>) = record.into_owned().into_iter().unzip(); let (cols, vals): (Vec<_>, Vec<_>) = record.into_iter().unzip();
old_column_names = cols; old_column_names = cols;
new_values.extend_from_slice(&vals); new_values.extend_from_slice(&vals);
} }

View File

@ -127,7 +127,6 @@ impl Iterator for UpdateCellIterator {
let mut value = self.iter.next()?; let mut value = self.iter.next()?;
let value = if let Value::Record { val, .. } = &mut value { let value = if let Value::Record { val, .. } = &mut value {
let val = val.to_mut();
if let Some(columns) = &self.columns { if let Some(columns) = &self.columns {
for (col, val) in val.iter_mut() { for (col, val) in val.iter_mut() {
if columns.contains(col) { if columns.contains(col) {

View File

@ -264,7 +264,7 @@ fn compact_primitive_description(mut value: Value) -> Value {
if val.len() != 1 { if val.len() != 1 {
return value; return value;
} }
if let Some(type_name) = val.to_mut().get_mut("type") { if let Some(type_name) = val.get_mut("type") {
return std::mem::take(type_name); return std::mem::take(type_name);
} }
} }
@ -300,8 +300,7 @@ fn describe_value(
), ),
head, head,
), ),
Value::Record { val, .. } => { Value::Record { mut val, .. } => {
let mut val = val.into_owned();
for (_k, v) in val.iter_mut() { for (_k, v) in val.iter_mut() {
*v = compact_primitive_description(describe_value( *v = compact_primitive_description(describe_value(
std::mem::take(v), std::mem::take(v),

View File

@ -269,7 +269,7 @@ impl<'a> std::fmt::Debug for DebuggableValue<'a> {
Value::Record { val, .. } => { Value::Record { val, .. } => {
write!(f, "{{")?; write!(f, "{{")?;
let mut first = true; let mut first = true;
for (col, value) in (&**val).into_iter() { for (col, value) in val {
if !first { if !first {
write!(f, ", ")?; write!(f, ", ")?;
} }

View File

@ -108,8 +108,7 @@ impl Iterator for UpdateCellIterator {
let span = val.span(); let span = val.span();
match val { match val {
Value::Record { val, .. } => Some(Value::record( Value::Record { val, .. } => Some(Value::record(
val.into_owned() val.into_iter()
.into_iter()
.map(|(col, val)| match &self.columns { .map(|(col, val)| match &self.columns {
Some(cols) if !cols.contains(&col) => (col, val), Some(cols) if !cols.contains(&col) => (col, val),
_ => ( _ => (

View File

@ -500,7 +500,7 @@ pub fn nu_value_to_params(value: Value) -> Result<NuSqlParams, ShellError> {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut params = Vec::with_capacity(val.len()); let mut params = Vec::with_capacity(val.len());
for (mut column, value) in val.into_owned().into_iter() { for (mut column, value) in val {
let sql_type_erased = value_to_sql(value)?; let sql_type_erased = value_to_sql(value)?;
if !column.starts_with([':', '@', '$']) { if !column.starts_with([':', '@', '$']) {

View File

@ -199,7 +199,7 @@ mod util {
let span = value.span(); let span = value.span();
match value { match value {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
let (cols, vals): (Vec<_>, Vec<_>) = record.into_owned().into_iter().unzip(); let (cols, vals): (Vec<_>, Vec<_>) = record.into_iter().unzip();
( (
cols, cols,
vec![vals vec![vals

View File

@ -40,7 +40,7 @@ impl Command for LoadEnv {
let record = match arg { let record = match arg {
Some(record) => record, Some(record) => record,
None => match input { None => match input {
PipelineData::Value(Value::Record { val, .. }, ..) => val.into_owned(), PipelineData::Value(Value::Record { val, .. }, ..) => val,
_ => { _ => {
return Err(ShellError::UnsupportedInput { return Err(ShellError::UnsupportedInput {
msg: "'load-env' expects a single record".into(), msg: "'load-env' expects a single record".into(),

View File

@ -82,7 +82,7 @@ fn with_env(
// single row([[X W]; [Y Z]]) // single row([[X W]; [Y Z]])
match &table[0] { match &table[0] {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (k, v) in &**val { for (k, v) in val {
env.insert(k.to_string(), v.clone()); env.insert(k.to_string(), v.clone());
} }
} }
@ -116,7 +116,7 @@ fn with_env(
} }
// when get object by `open x.json` or `from json` // when get object by `open x.json` or `from json`
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (k, v) in &**val { for (k, v) in val {
env.insert(k.clone(), v.clone()); env.insert(k.clone(), v.clone());
} }
} }

View File

@ -118,7 +118,6 @@ fn getcol(
}) })
} }
Value::Record { val, .. } => Ok(val Value::Record { val, .. } => Ok(val
.into_owned()
.into_iter() .into_iter()
.map(move |(x, _)| Value::string(x, head)) .map(move |(x, _)| Value::string(x, head))
.into_pipeline_data(ctrlc) .into_pipeline_data(ctrlc)

View File

@ -92,7 +92,7 @@ fn default(
} => { } => {
let mut found = false; let mut found = false;
for (col, val) in record.to_mut().iter_mut() { for (col, val) in record.iter_mut() {
if *col == column.item { if *col == column.item {
found = true; found = true;
if matches!(val, Value::Nothing { .. }) { if matches!(val, Value::Nothing { .. }) {
@ -102,7 +102,7 @@ fn default(
} }
if !found { if !found {
record.to_mut().push(column.item.clone(), value.clone()); record.push(column.item.clone(), value.clone());
} }
item item

View File

@ -123,7 +123,7 @@ fn drop_cols(
.. ..
} => { } => {
let len = record.len().saturating_sub(columns); let len = record.len().saturating_sub(columns);
record.to_mut().truncate(len); record.truncate(len);
Ok(v.into_pipeline_data_with_metadata(metadata)) Ok(v.into_pipeline_data_with_metadata(metadata))
} }
// Propagate errors // Propagate errors
@ -144,7 +144,7 @@ fn drop_cols(
fn drop_cols_set(val: &mut Value, head: Span, drop: usize) -> Result<HashSet<String>, ShellError> { fn drop_cols_set(val: &mut Value, head: Span, drop: usize) -> Result<HashSet<String>, ShellError> {
if let Value::Record { val: record, .. } = val { if let Value::Record { val: record, .. } = val {
let len = record.len().saturating_sub(drop); let len = record.len().saturating_sub(drop);
Ok(record.to_mut().drain(len..).map(|(col, _)| col).collect()) Ok(record.drain(len..).map(|(col, _)| col).collect())
} else { } else {
Err(unsupported_value_error(val, head)) Err(unsupported_value_error(val, head))
} }
@ -156,7 +156,7 @@ fn drop_record_cols(
drop_cols: &HashSet<String>, drop_cols: &HashSet<String>,
) -> Result<(), ShellError> { ) -> Result<(), ShellError> {
if let Value::Record { val, .. } = val { if let Value::Record { val, .. } = val {
val.to_mut().retain(|col, _| !drop_cols.contains(col)); val.retain(|col, _| !drop_cols.contains(col));
Ok(()) Ok(())
} else { } else {
Err(unsupported_value_error(val, head)) Err(unsupported_value_error(val, head))

View File

@ -156,7 +156,7 @@ fn flat_value(columns: &[CellPath], item: Value, all: bool) -> Vec<Value> {
let mut out = IndexMap::<String, Value>::new(); let mut out = IndexMap::<String, Value>::new();
let mut inner_table = None; let mut inner_table = None;
for (column_index, (column, value)) in val.into_owned().into_iter().enumerate() { for (column_index, (column, value)) in val.into_iter().enumerate() {
let column_requested = columns.iter().find(|c| c.to_string() == column); let column_requested = columns.iter().find(|c| c.to_string() == column);
let need_flatten = { columns.is_empty() || column_requested.is_some() }; let need_flatten = { columns.is_empty() || column_requested.is_some() };
let span = value.span(); let span = value.span();
@ -164,7 +164,7 @@ fn flat_value(columns: &[CellPath], item: Value, all: bool) -> Vec<Value> {
match value { match value {
Value::Record { ref val, .. } => { Value::Record { ref val, .. } => {
if need_flatten { if need_flatten {
for (col, val) in val.clone().into_owned() { for (col, val) in val.clone() {
if out.contains_key(&col) { if out.contains_key(&col) {
out.insert(format!("{column}_{col}"), val); out.insert(format!("{column}_{col}"), val);
} else { } else {

View File

@ -149,7 +149,6 @@ fn replace_headers(
if let Value::Record { val: record, .. } = value { if let Value::Record { val: record, .. } = value {
Ok(Value::record( Ok(Value::record(
record record
.into_owned()
.into_iter() .into_iter()
.filter_map(|(col, val)| { .filter_map(|(col, val)| {
old_headers old_headers

View File

@ -55,7 +55,6 @@ impl Command for Items {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut closure = ClosureEval::new(engine_state, stack, closure); let mut closure = ClosureEval::new(engine_state, stack, closure);
Ok(val Ok(val
.into_owned()
.into_iter() .into_iter()
.map_while(move |(col, val)| { .map_while(move |(col, val)| {
let result = closure let result = closure

View File

@ -148,8 +148,7 @@ fn rename(
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
let record = let record =
if let Some(closure) = &mut closure { if let Some(closure) = &mut closure {
record record.into_iter()
.into_owned().into_iter()
.map(|(col, val)| { .map(|(col, val)| {
let col = Value::string(col, span); let col = Value::string(col, span);
let data = closure.run_with_value(col)?; let data = closure.run_with_value(col)?;
@ -163,7 +162,7 @@ fn rename(
// record columns are unique so we can track the number // record columns are unique so we can track the number
// of renamed columns to check if any were missed // of renamed columns to check if any were missed
let mut renamed = 0; let mut renamed = 0;
let record = record.into_owned().into_iter().map(|(col, val)| { let record = record.into_iter().map(|(col, val)| {
let col = if let Some(col) = columns.get(&col) { let col = if let Some(col) = columns.get(&col) {
renamed += 1; renamed += 1;
col.clone() col.clone()
@ -194,7 +193,7 @@ fn rename(
} }
} }
None => Ok(record None => Ok(record
.into_owned().into_iter() .into_iter()
.enumerate() .enumerate()
.map(|(i, (col, val))| { .map(|(i, (col, val))| {
(columns.get(i).cloned().unwrap_or(col), val) (columns.get(i).cloned().unwrap_or(col), val)

View File

@ -144,14 +144,7 @@ impl Command for Sort {
// Records have two sorting methods, toggled by presence or absence of -v // Records have two sorting methods, toggled by presence or absence of -v
PipelineData::Value(Value::Record { val, .. }, ..) => { PipelineData::Value(Value::Record { val, .. }, ..) => {
let sort_by_value = call.has_flag(engine_state, stack, "values")?; let sort_by_value = call.has_flag(engine_state, stack, "values")?;
let record = sort_record( let record = sort_record(val, span, sort_by_value, reverse, insensitive, natural);
val.into_owned(),
span,
sort_by_value,
reverse,
insensitive,
natural,
);
Ok(record.into_pipeline_data()) Ok(record.into_pipeline_data())
} }
// Other values are sorted here // Other values are sorted here

View File

@ -187,11 +187,11 @@ pub fn data_split(
let span = v.span(); let span = v.span();
match v { match v {
Value::Record { val: grouped, .. } => { Value::Record { val: grouped, .. } => {
for (outer_key, list) in grouped.into_owned() { for (outer_key, list) in grouped {
match data_group(&list, splitter, span) { match data_group(&list, splitter, span) {
Ok(grouped_vals) => { Ok(grouped_vals) => {
if let Value::Record { val: sub, .. } = grouped_vals { if let Value::Record { val: sub, .. } = grouped_vals {
for (inner_key, subset) in sub.into_owned() { for (inner_key, subset) in sub {
let s: &mut IndexMap<String, Value> = let s: &mut IndexMap<String, Value> =
splits.entry(inner_key).or_default(); splits.entry(inner_key).or_default();

View File

@ -194,7 +194,6 @@ fn sort_attributes(val: Value) -> Value {
Value::Record { val, .. } => { Value::Record { val, .. } => {
// TODO: sort inplace // TODO: sort inplace
let sorted = val let sorted = val
.into_owned()
.into_iter() .into_iter()
.sorted_by(|a, b| a.0.cmp(&b.0)) .sorted_by(|a, b| a.0.cmp(&b.0))
.collect_vec(); .collect_vec();

View File

@ -106,7 +106,7 @@ pub fn get_values<'a>(
for item in input { for item in input {
match item { match item {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (k, v) in &**val { for (k, v) in val {
if let Some(vec) = output.get_mut(k) { if let Some(vec) = output.get_mut(k) {
vec.push(v.clone()); vec.push(v.clone());
} else { } else {
@ -171,7 +171,6 @@ fn values(
})?, })?,
}; };
Ok(record Ok(record
.into_owned()
.into_values() .into_values()
.into_pipeline_data_with_metadata(metadata, ctrlc)) .into_pipeline_data_with_metadata(metadata, ctrlc))
} }

View File

@ -130,7 +130,7 @@ pub fn value_to_json_value(v: &Value) -> Result<nu_json::Value, ShellError> {
} }
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut m = nu_json::Map::new(); 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)?); m.insert(k.clone(), value_to_json_value(v)?);
} }
nu_json::Value::Object(m) nu_json::Value::Object(m)

View File

@ -125,7 +125,6 @@ fn local_into_string(value: Value, separator: &str, config: &Config) -> String {
.collect::<Vec<_>>() .collect::<Vec<_>>()
.join(separator), .join(separator),
Value::Record { val, .. } => val Value::Record { val, .. } => val
.into_owned()
.into_iter() .into_iter()
.map(|(x, y)| format!("{}: {}", x, local_into_string(y, ", ", config))) .map(|(x, y)| format!("{}: {}", x, local_into_string(y, ", ", config)))
.collect::<Vec<_>>() .collect::<Vec<_>>()

View File

@ -57,7 +57,7 @@ fn helper(engine_state: &EngineState, v: &Value) -> Result<toml::Value, ShellErr
Value::String { val, .. } | Value::Glob { val, .. } => toml::Value::String(val.clone()), Value::String { val, .. } | Value::Glob { val, .. } => toml::Value::String(val.clone()),
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut m = toml::map::Map::new(); 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)?); m.insert(k.clone(), helper(engine_state, v)?);
} }
toml::Value::Table(m) toml::Value::Table(m)

View File

@ -325,7 +325,7 @@ impl Job {
// alternatives like {tag: a attributes: {} content: []}, {tag: a attribbutes: null // alternatives like {tag: a attributes: {} content: []}, {tag: a attribbutes: null
// content: null}, {tag: a}. See to_xml_entry for more // content: null}, {tag: a}. See to_xml_entry for more
let attrs = match attrs { let attrs = match attrs {
Value::Record { val, .. } => val.into_owned(), Value::Record { val, .. } => val,
Value::Nothing { .. } => Record::new(), Value::Nothing { .. } => Record::new(),
_ => { _ => {
return Err(ShellError::CantConvert { return Err(ShellError::CantConvert {

View File

@ -54,7 +54,7 @@ pub fn value_to_yaml_value(v: &Value) -> Result<serde_yaml::Value, ShellError> {
} }
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut m = serde_yaml::Mapping::new(); let mut m = serde_yaml::Mapping::new();
for (k, v) in &**val { for (k, v) in val {
m.insert( m.insert(
serde_yaml::Value::String(k.clone()), serde_yaml::Value::String(k.clone()),
value_to_yaml_value(v)?, value_to_yaml_value(v)?,

View File

@ -112,7 +112,7 @@ used as the next argument to the closure, otherwise generation stops.
match value { match value {
// {out: ..., next: ...} -> output and continue // {out: ..., next: ...} -> output and continue
Value::Record { val, .. } => { Value::Record { val, .. } => {
let iter = val.into_owned().into_iter(); let iter = val.into_iter();
let mut out = None; let mut out = None;
let mut next = None; let mut next = None;
let mut err = None; let mut err = None;

View File

@ -152,7 +152,7 @@ pub fn highlight_search_in_table(
}); });
}; };
let has_match = record.to_mut().iter_mut().try_fold( let has_match = record.iter_mut().try_fold(
false, false,
|acc: bool, (col, val)| -> Result<bool, ShellError> { |acc: bool, (col, val)| -> Result<bool, ShellError> {
if !searched_cols.contains(&col.as_str()) { if !searched_cols.contains(&col.as_str()) {

View File

@ -27,7 +27,7 @@ fn helper_for_tables(
for val in values { for val in values {
match val { match val {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (key, value) in &**val { for (key, value) in val {
column_values column_values
.entry(key.clone()) .entry(key.clone())
.and_modify(|v: &mut Vec<Value>| v.push(value.clone())) .and_modify(|v: &mut Vec<Value>| v.push(value.clone()))
@ -80,15 +80,13 @@ pub fn calculate(
), ),
_ => mf(vals, span, name), _ => mf(vals, span, name),
}, },
PipelineData::Value(Value::Record { val, .. }, ..) => { PipelineData::Value(Value::Record { mut val, .. }, ..) => {
let mut record = val.into_owned(); val.iter_mut()
record
.iter_mut()
.try_for_each(|(_, val)| -> Result<(), ShellError> { .try_for_each(|(_, val)| -> Result<(), ShellError> {
*val = mf(slice::from_ref(val), span, name)?; *val = mf(slice::from_ref(val), span, name)?;
Ok(()) Ok(())
})?; })?;
Ok(Value::record(record, span)) Ok(Value::record(val, span))
} }
PipelineData::Value(Value::Range { val, .. }, ..) => { PipelineData::Value(Value::Range { val, .. }, ..) => {
let new_vals: Result<Vec<Value>, ShellError> = val let new_vals: Result<Vec<Value>, ShellError> = val

View File

@ -222,7 +222,7 @@ pub fn send_request(
Value::Record { val, .. } if body_type == BodyType::Form => { Value::Record { val, .. } if body_type == BodyType::Form => {
let mut data: Vec<(String, String)> = Vec::with_capacity(val.len()); let mut data: Vec<(String, String)> = Vec::with_capacity(val.len());
for (col, val) in val.into_owned() { for (col, val) in val {
data.push((col, val.coerce_into_string()?)) data.push((col, val.coerce_into_string()?))
} }
@ -336,7 +336,7 @@ pub fn request_add_custom_headers(
match &headers { match &headers {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (k, v) in &**val { for (k, v) in val {
custom_headers.insert(k.to_string(), v.clone()); custom_headers.insert(k.to_string(), v.clone());
} }
} }
@ -346,7 +346,7 @@ pub fn request_add_custom_headers(
// single row([key1 key2]; [val1 val2]) // single row([key1 key2]; [val1 val2])
match &table[0] { match &table[0] {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (k, v) in &**val { for (k, v) in val {
custom_headers.insert(k.to_string(), v.clone()); custom_headers.insert(k.to_string(), v.clone());
} }
} }

View File

@ -65,7 +65,7 @@ fn to_url(input: PipelineData, head: Span) -> Result<PipelineData, ShellError> {
match value { match value {
Value::Record { ref val, .. } => { Value::Record { ref val, .. } => {
let mut row_vec = vec![]; let mut row_vec = vec![];
for (k, v) in &**val { for (k, v) in val {
match v.coerce_string() { match v.coerce_string() {
Ok(s) => { Ok(s) => {
row_vec.push((k.clone(), s)); row_vec.push((k.clone(), s));

View File

@ -92,7 +92,6 @@ impl Command for SubCommand {
match value { match value {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let url_components = val let url_components = val
.into_owned()
.into_iter() .into_iter()
.try_fold(UrlComponents::new(), |url, (k, v)| { .try_fold(UrlComponents::new(), |url, (k, v)| {
url.add_component(k, v, span, engine_state) url.add_component(k, v, span, engine_state)
@ -180,7 +179,6 @@ impl UrlComponents {
return match value { return match value {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut qs = val let mut qs = val
.into_owned()
.into_iter() .into_iter()
.map(|(k, v)| match v.coerce_into_string() { .map(|(k, v)| match v.coerce_into_string() {
Ok(val) => Ok(format!("{k}={val}")), Ok(val) => Ok(format!("{k}={val}")),

View File

@ -108,7 +108,7 @@ prints out the list properly."#
// dbg!("value::record"); // dbg!("value::record");
let mut items = vec![]; let mut items = vec![];
for (i, (c, v)) in val.into_owned().into_iter().enumerate() { for (i, (c, v)) in val.into_iter().enumerate() {
items.push((i, c, v.to_expanded_string(", ", config))) items.push((i, c, v.to_expanded_string(", ", config)))
} }

View File

@ -392,7 +392,7 @@ fn handle_table_command(
} }
PipelineData::Value(Value::Record { val, .. }, ..) => { PipelineData::Value(Value::Record { val, .. }, ..) => {
input.data = PipelineData::Empty; input.data = PipelineData::Empty;
handle_record(input, cfg, val.into_owned()) handle_record(input, cfg, val)
} }
PipelineData::Value(Value::LazyRecord { val, .. }, ..) => { PipelineData::Value(Value::LazyRecord { val, .. }, ..) => {
input.data = val.collect()?.into_pipeline_data(); input.data = val.collect()?.into_pipeline_data();
@ -557,7 +557,7 @@ fn handle_row_stream(
stream.map(move |mut x| match &mut x { stream.map(move |mut x| match &mut x {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
// Only the name column gets special colors, for now // Only the name column gets special colors, for now
if let Some(value) = record.to_mut().get_mut("name") { if let Some(value) = record.get_mut("name") {
let span = value.span(); let span = value.span();
if let Value::String { val, .. } = value { if let Value::String { val, .. } = value {
if let Some(val) = render_path_name(val, &config, &ls_colors, span) if let Some(val) = render_path_name(val, &config, &ls_colors, span)
@ -583,7 +583,7 @@ fn handle_row_stream(
ListStream::from_stream( ListStream::from_stream(
stream.map(move |mut x| match &mut x { stream.map(move |mut x| match &mut x {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
for (rec_col, rec_val) in record.to_mut().iter_mut() { for (rec_col, rec_val) in record.iter_mut() {
// Every column in the HTML theme table except 'name' is colored // Every column in the HTML theme table except 'name' is colored
if rec_col != "name" { if rec_col != "name" {
continue; continue;

View File

@ -376,7 +376,7 @@ fn get_argument_for_color_value(
) -> Option<Argument> { ) -> Option<Argument> {
match color { match color {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let record_exp: Vec<RecordItem> = (**val) let record_exp: Vec<RecordItem> = val
.iter() .iter()
.map(|(k, v)| { .map(|(k, v)| {
RecordItem::Pair( RecordItem::Pair(

View File

@ -87,7 +87,7 @@ pub fn collect_input(value: Value) -> (Vec<String>, Vec<Vec<Value>>) {
let span = value.span(); let span = value.span();
match value { match value {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
let (key, val) = record.into_owned().into_iter().unzip(); let (key, val) = record.into_iter().unzip();
(key, vec![val]) (key, vec![val])
} }
Value::List { vals, .. } => { Value::List { vals, .. } => {

View File

@ -1038,7 +1038,7 @@ fn set_config(hm: &mut HashMap<String, Value>, path: &[&str], value: Value) -> b
if path.len() == 2 { if path.len() == 2 {
let key = path[1]; let key = path[1];
record.to_mut().insert(key, value); record.insert(key, value);
} else { } else {
let mut hm2: HashMap<String, Value> = HashMap::new(); let mut hm2: HashMap<String, Value> = HashMap::new();
for (k, v) in record.iter() { for (k, v) in record.iter() {

View File

@ -319,8 +319,8 @@ impl PluginTest {
// reorder cols and vals to make more logically compare. // reorder cols and vals to make more logically compare.
// more general, if two record have same col and values, // more general, if two record have same col and values,
// the order of cols shouldn't affect the equal property. // the order of cols shouldn't affect the equal property.
let mut a_rec = a_rec.clone().into_owned(); let mut a_rec = a_rec.clone();
let mut b_rec = b_rec.clone().into_owned(); let mut b_rec = b_rec.clone();
a_rec.sort_cols(); a_rec.sort_cols();
b_rec.sort_cols(); b_rec.sort_cols();

View File

@ -39,7 +39,7 @@ pub(super) fn create_hooks(value: &Value) -> Result<Hooks, ShellError> {
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut hooks = Hooks::new(); let mut hooks = Hooks::new();
for (col, val) in &**val { for (col, val) in val {
match col.as_str() { match col.as_str() {
"pre_prompt" => hooks.pre_prompt = Some(val.clone()), "pre_prompt" => hooks.pre_prompt = Some(val.clone()),
"pre_execution" => hooks.pre_execution = Some(val.clone()), "pre_execution" => hooks.pre_execution = Some(val.clone()),

View File

@ -202,13 +202,13 @@ impl Value {
// the `2`. // the `2`.
if let Value::Record { val, .. } = self { if let Value::Record { val, .. } = self {
val.to_mut().retain_mut(|key, value| { val.retain_mut(|key, value| {
let span = value.span(); let span = value.span();
match key { match key {
// Grouped options // Grouped options
"ls" => { "ls" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"use_ls_colors" => { "use_ls_colors" => {
@ -237,7 +237,7 @@ impl Value {
} }
"rm" => { "rm" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"always_trash" => { "always_trash" => {
@ -264,7 +264,7 @@ impl Value {
"history" => { "history" => {
let history = &mut config.history; let history = &mut config.history;
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"isolation" => { "isolation" => {
@ -306,7 +306,7 @@ impl Value {
} }
"completions" => { "completions" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"quick" => { "quick" => {
@ -327,7 +327,7 @@ impl Value {
} }
"external" => { "external" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key3, value| val.retain_mut(|key3, value|
{ {
let span = value.span(); let span = value.span();
match key3 { match key3 {
@ -394,7 +394,7 @@ impl Value {
} }
"cursor_shape" => { "cursor_shape" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
let config_point = match key2 { let config_point = match key2 {
"vi_insert" => &mut config.cursor_shape_vi_insert, "vi_insert" => &mut config.cursor_shape_vi_insert,
@ -427,7 +427,7 @@ impl Value {
} }
"table" => { "table" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"mode" => { "mode" => {
@ -452,7 +452,7 @@ impl Value {
} }
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut invalid = false; let mut invalid = false;
val.to_mut().retain(|key3, value| { val.retain(|key3, value| {
match key3 { match key3 {
"left" => { "left" => {
match value.as_int() { match value.as_int() {
@ -547,7 +547,7 @@ impl Value {
} }
"filesize" => { "filesize" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| { val.retain_mut(|key2, value| {
let span = value.span(); let span = value.span();
match key2 { match key2 {
"metric" => { "metric" => {
@ -720,7 +720,7 @@ impl Value {
}, },
"datetime_format" => { "datetime_format" => {
if let Value::Record { val, .. } = value { if let Value::Record { val, .. } = value {
val.to_mut().retain_mut(|key2, value| val.retain_mut(|key2, value|
{ {
let span = value.span(); let span = value.span();
match key2 { match key2 {

View File

@ -39,7 +39,7 @@ impl PluginGcConfigs {
self.plugins = HashMap::new(); self.plugins = HashMap::new();
} }
val.to_mut().retain_mut(|key, value| { val.retain_mut(|key, value| {
let span = value.span(); let span = value.span();
match key { match key {
"default" => { "default" => {
@ -88,7 +88,7 @@ fn process_plugins(
// Remove any plugin configs that aren't in the value // Remove any plugin configs that aren't in the value
plugins.retain(|key, _| val.contains(key)); plugins.retain(|key, _| val.contains(key));
val.to_mut().retain_mut(|key, value| { val.retain_mut(|key, value| {
if matches!(value, Value::Record { .. }) { if matches!(value, Value::Record { .. }) {
plugins.entry(key.to_owned()).or_default().process( plugins.entry(key.to_owned()).or_default().process(
&join_path(path, &[key]), &join_path(path, &[key]),
@ -150,7 +150,7 @@ impl PluginGcConfig {
self.stop_after = PluginGcConfig::default().stop_after; self.stop_after = PluginGcConfig::default().stop_after;
} }
val.to_mut().retain_mut(|key, value| { val.retain_mut(|key, value| {
let span = value.span(); let span = value.span();
match key { match key {
"enabled" => process_bool_config(value, errors, &mut self.enabled), "enabled" => process_bool_config(value, errors, &mut self.enabled),

View File

@ -23,7 +23,7 @@ impl Matcher for Pattern {
Pattern::Record(field_patterns) => match value { Pattern::Record(field_patterns) => match value {
Value::Record { val, .. } => { Value::Record { val, .. } => {
'top: for field_pattern in field_patterns { 'top: for field_pattern in field_patterns {
for (col, val) in &**val { for (col, val) in val {
if col == &field_pattern.0 { if col == &field_pattern.0 {
// We have found the field // We have found the field
let result = field_pattern.1.match_value(val, matches); let result = field_pattern.1.match_value(val, matches);

View File

@ -75,7 +75,7 @@ pub trait Eval {
RecordItem::Spread(_, inner) => { RecordItem::Spread(_, inner) => {
match Self::eval::<D>(state, mut_state, inner)? { match Self::eval::<D>(state, mut_state, inner)? {
Value::Record { val: inner_val, .. } => { Value::Record { val: inner_val, .. } => {
for (col_name, val) in inner_val.into_owned() { for (col_name, val) in inner_val {
if let Some(orig_span) = col_names.get(&col_name) { if let Some(orig_span) = col_names.get(&col_name) {
return Err(ShellError::ColumnDefinedTwice { return Err(ShellError::ColumnDefinedTwice {
col_name, col_name,

View File

@ -538,7 +538,7 @@ impl FromValue for Vec<Value> {
impl FromValue for Record { impl FromValue for Record {
fn from_value(v: Value) -> Result<Self, ShellError> { fn from_value(v: Value) -> Result<Self, ShellError> {
match v { match v {
Value::Record { val, .. } => Ok(val.into_owned()), Value::Record { val, .. } => Ok(val),
v => Err(ShellError::CantConvert { v => Err(ShellError::CantConvert {
to_type: "Record".into(), to_type: "Record".into(),
from_type: v.get_type().to_string(), from_type: v.get_type().to_string(),

View File

@ -29,7 +29,7 @@ use fancy_regex::Regex;
use nu_utils::{ use nu_utils::{
contains_emoji, contains_emoji,
locale::{get_system_locale_string, LOCALE_OVERRIDE_ENV_VAR}, locale::{get_system_locale_string, LOCALE_OVERRIDE_ENV_VAR},
IgnoreCaseExt, SharedCow, IgnoreCaseExt,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{ use std::{
@ -527,7 +527,7 @@ impl Value {
/// Unwraps the inner [`Record`] value or returns an error if this `Value` is not a record /// Unwraps the inner [`Record`] value or returns an error if this `Value` is not a record
pub fn into_record(self) -> Result<Record, ShellError> { pub fn into_record(self) -> Result<Record, ShellError> {
if let Value::Record { val, .. } = self { if let Value::Record { val, .. } = self {
Ok(val.into_owned()) Ok(val)
} else { } else {
self.cant_convert_to("record") self.cant_convert_to("record")
} }
@ -1112,7 +1112,7 @@ impl Value {
match current { match current {
Value::Record { mut val, .. } => { Value::Record { mut val, .. } => {
// Make reverse iterate to avoid duplicate column leads to first value, actually last value is expected. // Make reverse iterate to avoid duplicate column leads to first value, actually last value is expected.
if let Some(found) = val.to_mut().iter_mut().rev().find(|x| { if let Some(found) = val.iter_mut().rev().find(|x| {
if insensitive { if insensitive {
x.0.eq_ignore_case(column_name) x.0.eq_ignore_case(column_name)
} else { } else {
@ -1173,15 +1173,13 @@ impl Value {
let val_span = val.span(); let val_span = val.span();
match val { match val {
Value::Record { mut val, .. } => { Value::Record { mut val, .. } => {
if let Some(found) = if let Some(found) = val.iter_mut().rev().find(|x| {
val.to_mut().iter_mut().rev().find(|x| {
if insensitive { if insensitive {
x.0.eq_ignore_case(column_name) x.0.eq_ignore_case(column_name)
} else { } else {
x.0 == column_name x.0 == column_name
} }
}) }) {
{
Ok(std::mem::take(found.1)) Ok(std::mem::take(found.1))
} else if *optional { } else if *optional {
Ok(Value::nothing(*origin_span)) Ok(Value::nothing(*origin_span))
@ -1287,7 +1285,7 @@ impl Value {
for val in vals.iter_mut() { for val in vals.iter_mut() {
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.upsert_data_at_cell_path(path, new_val.clone())?; val.upsert_data_at_cell_path(path, new_val.clone())?;
} else { } else {
let new_col = if path.is_empty() { let new_col = if path.is_empty() {
@ -1299,7 +1297,7 @@ impl Value {
.upsert_data_at_cell_path(path, new_val.clone())?; .upsert_data_at_cell_path(path, new_val.clone())?;
new_col new_col
}; };
record.to_mut().push(col_name, new_col); record.push(col_name, new_col);
} }
} }
Value::Error { error, .. } => return Err(*error.clone()), Value::Error { error, .. } => return Err(*error.clone()),
@ -1314,7 +1312,7 @@ impl Value {
} }
} }
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.upsert_data_at_cell_path(path, new_val)?; val.upsert_data_at_cell_path(path, new_val)?;
} else { } else {
let new_col = if path.is_empty() { let new_col = if path.is_empty() {
@ -1324,7 +1322,7 @@ impl Value {
new_col.upsert_data_at_cell_path(path, new_val)?; new_col.upsert_data_at_cell_path(path, new_val)?;
new_col new_col
}; };
record.to_mut().push(col_name, new_col); record.push(col_name, new_col);
} }
} }
Value::LazyRecord { val, .. } => { Value::LazyRecord { val, .. } => {
@ -1411,7 +1409,7 @@ impl Value {
let v_span = val.span(); let v_span = val.span();
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.update_data_at_cell_path(path, new_val.clone())?; val.update_data_at_cell_path(path, new_val.clone())?;
} else { } else {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
@ -1433,7 +1431,7 @@ impl Value {
} }
} }
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.update_data_at_cell_path(path, new_val)?; val.update_data_at_cell_path(path, new_val)?;
} else { } else {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
@ -1503,7 +1501,7 @@ impl Value {
let v_span = val.span(); let v_span = val.span();
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if record.to_mut().remove(col_name).is_none() && !optional { if record.remove(col_name).is_none() && !optional {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
col_name: col_name.clone(), col_name: col_name.clone(),
span: *span, span: *span,
@ -1523,7 +1521,7 @@ impl Value {
Ok(()) Ok(())
} }
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if record.to_mut().remove(col_name).is_none() && !optional { if record.remove(col_name).is_none() && !optional {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
col_name: col_name.clone(), col_name: col_name.clone(),
span: *span, span: *span,
@ -1583,7 +1581,7 @@ impl Value {
let v_span = val.span(); let v_span = val.span();
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.remove_data_at_cell_path(path)?; val.remove_data_at_cell_path(path)?;
} else if !optional { } else if !optional {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
@ -1605,7 +1603,7 @@ impl Value {
Ok(()) Ok(())
} }
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
val.remove_data_at_cell_path(path)?; val.remove_data_at_cell_path(path)?;
} else if !optional { } else if !optional {
return Err(ShellError::CantFindColumn { return Err(ShellError::CantFindColumn {
@ -1675,7 +1673,7 @@ impl Value {
let v_span = val.span(); let v_span = val.span();
match val { match val {
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
if path.is_empty() { if path.is_empty() {
return Err(ShellError::ColumnAlreadyExists { return Err(ShellError::ColumnAlreadyExists {
col_name: col_name.clone(), col_name: col_name.clone(),
@ -1702,7 +1700,7 @@ impl Value {
)?; )?;
new_col new_col
}; };
record.to_mut().push(col_name, new_col); record.push(col_name, new_col);
} }
} }
Value::Error { error, .. } => return Err(*error.clone()), Value::Error { error, .. } => return Err(*error.clone()),
@ -1718,7 +1716,7 @@ impl Value {
} }
} }
Value::Record { val: record, .. } => { Value::Record { val: record, .. } => {
if let Some(val) = record.to_mut().get_mut(col_name) { if let Some(val) = record.get_mut(col_name) {
if path.is_empty() { if path.is_empty() {
return Err(ShellError::ColumnAlreadyExists { return Err(ShellError::ColumnAlreadyExists {
col_name: col_name.clone(), col_name: col_name.clone(),
@ -1736,7 +1734,7 @@ impl Value {
new_col.insert_data_at_cell_path(path, new_val, head_span)?; new_col.insert_data_at_cell_path(path, new_val, head_span)?;
new_col new_col
}; };
record.to_mut().push(col_name, new_col); record.push(col_name, new_col);
} }
} }
Value::LazyRecord { val, .. } => { Value::LazyRecord { val, .. } => {
@ -1809,7 +1807,6 @@ impl Value {
// Check for contained values // Check for contained values
match self { match self {
Value::Record { ref mut val, .. } => val Value::Record { ref mut val, .. } => val
.to_mut()
.iter_mut() .iter_mut()
.try_for_each(|(_, rec_value)| rec_value.recurse_mut(f)), .try_for_each(|(_, rec_value)| rec_value.recurse_mut(f)),
Value::List { ref mut vals, .. } => vals Value::List { ref mut vals, .. } => vals
@ -1944,7 +1941,7 @@ impl Value {
pub fn record(val: Record, span: Span) -> Value { pub fn record(val: Record, span: Span) -> Value {
Value::Record { Value::Record {
val: SharedCow::new(val), val,
internal_span: span, internal_span: span,
} }
} }
@ -2364,8 +2361,8 @@ impl PartialOrd for Value {
// reorder cols and vals to make more logically compare. // reorder cols and vals to make more logically compare.
// more general, if two record have same col and values, // more general, if two record have same col and values,
// the order of cols shouldn't affect the equal property. // the order of cols shouldn't affect the equal property.
let mut lhs = lhs.clone().into_owned(); let mut lhs = lhs.clone();
let mut rhs = rhs.clone().into_owned(); let mut rhs = rhs.clone();
lhs.sort_cols(); lhs.sort_cols();
rhs.sort_cols(); rhs.sort_cols();

View File

@ -98,6 +98,7 @@ impl Record {
pub fn get_mut(&mut self, col: impl AsRef<str>) -> Option<&mut Value> { pub fn get_mut(&mut self, col: impl AsRef<str>) -> Option<&mut Value> {
self.inner self.inner
.make_mut()
.iter_mut() .iter_mut()
.find_map(|(k, v)| if k == col.as_ref() { Some(v) } else { None }) .find_map(|(k, v)| if k == col.as_ref() { Some(v) } else { None })
} }
@ -288,7 +289,7 @@ impl Record {
/// ); /// );
/// ``` /// ```
pub fn sort_cols(&mut self) { pub fn sort_cols(&mut self) {
self.inner.sort_by(|(k1, _), (k2, _)| k1.cmp(k2)) self.inner.make_mut().sort_by(|(k1, _), (k2, _)| k1.cmp(k2))
} }
} }
@ -503,7 +504,7 @@ impl<'a> IntoIterator for &'a mut Record {
fn into_iter(self) -> Self::IntoIter { fn into_iter(self) -> Self::IntoIter {
IterMut { IterMut {
iter: self.inner.iter_mut(), iter: self.inner.make_mut().iter_mut(),
} }
} }
} }

View File

@ -3,8 +3,7 @@ use crate::{
StringResult, TableOpts, UnstructuredTable, StringResult, TableOpts, UnstructuredTable,
}; };
use nu_color_config::StyleComputer; use nu_color_config::StyleComputer;
use nu_protocol::{Config, Record, TableMode, Value}; use nu_protocol::{Config, TableMode, Value};
use nu_utils::SharedCow;
pub struct CollapsedTable; pub struct CollapsedTable;
@ -49,9 +48,7 @@ fn colorize_value(value: &mut Value, config: &Config, style_computer: &StyleComp
// Take ownership of the record and reassign to &mut // Take ownership of the record and reassign to &mut
// We do this to have owned keys through `.into_iter` // We do this to have owned keys through `.into_iter`
let record = std::mem::take(val); let record = std::mem::take(val);
*val = SharedCow::new( *val = record
record
.into_owned()
.into_iter() .into_iter()
.map(|(mut header, mut val)| { .map(|(mut header, mut val)| {
colorize_value(&mut val, config, style_computer); colorize_value(&mut val, config, style_computer);
@ -61,8 +58,7 @@ fn colorize_value(value: &mut Value, config: &Config, style_computer: &StyleComp
} }
(header, val) (header, val)
}) })
.collect::<Record>(), .collect();
);
} }
Value::List { vals, .. } => { Value::List { vals, .. } => {
for val in vals { for val in vals {

View File

@ -89,7 +89,7 @@ fn build_table(
fn convert_nu_value_to_table_value(value: Value, config: &Config) -> TableValue { fn convert_nu_value_to_table_value(value: Value, config: &Config) -> TableValue {
match value { match value {
Value::Record { val, .. } => build_vertical_map(val.into_owned(), config), Value::Record { val, .. } => build_vertical_map(val, config),
Value::List { vals, .. } => { Value::List { vals, .. } => {
let rebuild_array_as_map = is_valid_record(&vals) && count_columns_in_record(&vals) > 0; let rebuild_array_as_map = is_valid_record(&vals) && count_columns_in_record(&vals) > 0;
if rebuild_array_as_map { if rebuild_array_as_map {
@ -195,8 +195,7 @@ fn build_map_from_record(vals: Vec<Value>, config: &Config) -> TableValue {
for val in vals { for val in vals {
match val { match val {
Value::Record { val, .. } => { Value::Record { val, .. } => {
for (i, (_key, val)) in val.into_owned().into_iter().take(count_columns).enumerate() for (i, (_key, val)) in val.into_iter().take(count_columns).enumerate() {
{
let cell = convert_nu_value_to_table_value(val, config); let cell = convert_nu_value_to_table_value(val, config);
list[i].push(cell); list[i].push(cell);
} }

View File

@ -177,11 +177,9 @@ impl NuDataFrame {
conversion::insert_record(&mut column_values, record, &maybe_schema)? conversion::insert_record(&mut column_values, record, &maybe_schema)?
} }
Value::Record { val: record, .. } => conversion::insert_record( Value::Record { val: record, .. } => {
&mut column_values, conversion::insert_record(&mut column_values, record, &maybe_schema)?
record.into_owned(), }
&maybe_schema,
)?,
_ => { _ => {
let key = "0".to_string(); let key = "0".to_string();
conversion::insert_value(value, key, &mut column_values, &maybe_schema)? conversion::insert_value(value, key, &mut column_values, &maybe_schema)?

View File

@ -201,7 +201,7 @@ fn value_to_string(
}, },
Value::Record { val, .. } => { Value::Record { val, .. } => {
let mut collection = vec![]; let mut collection = vec![];
for (col, val) in &**val { for (col, val) in val {
collection.push(if needs_quotes(col) { collection.push(if needs_quotes(col) {
format!( format!(
"{idt_po}\"{}\": {}", "{idt_po}\"{}\": {}",