Construct Records only through checked helpers (#11386)

# Description

Constructing the internals of `Record` without checking the lengths is
bad. (also incompatible with changes to how we store records)

- Use `Record::from_raw_cols_vals` in dataframe code
- Use `record!` macro in dataframe test
- Use `record!` in `nu-color-config` tests
- Stop direct record construction in `nu-command`
- Refactor table construction in `from nuon`

# User-Facing Changes
None

# Tests + Formatting
No new tests, updated tests in equal fashion
This commit is contained in:
Stefan Holderbach
2023-12-21 16:48:15 +01:00
committed by GitHub
parent 6f384da57e
commit 8cfa96b4c0
8 changed files with 39 additions and 59 deletions

View File

@ -499,13 +499,7 @@ pub fn convert_sqlite_row_to_nu_value(row: &Row, span: Span, column_names: Vec<S
vals.push(val);
}
Value::record(
Record {
cols: column_names,
vals,
},
span,
)
Value::record(Record::from_raw_cols_vals(column_names, vals), span)
}
pub fn convert_sqlite_value_to_nu_value(value: ValueRef, span: Span) -> Value {