forked from extern/nushell
Use Record APIs in nu-protocol
/nu-engine
(#10917)
# Description Consequences of #10841 This does not yet make the assumption that columns are always duplicated. Follow the existing logic here - Use saner record API in `nu-engine/src/eval.rs` - Use checked record construction in `nu-engine/src/scope.rs` - Use `values` iterator in `nu-engine/src/scope.rs` - Use `columns` iterator in `nu_engine::get_columns()` - Start using record API in `value/mod.rs` - Use `.insert` in `eval_const.rs` Record code - Record API for `eval_const.rs` table code # User-Facing Changes None # Tests + Formatting None
This commit is contained in:
committed by
GitHub
parent
0569a9c92e
commit
a46048f362
@ -552,7 +552,7 @@ pub fn eval_expression(
|
||||
for (col, val) in fields {
|
||||
// avoid duplicate cols.
|
||||
let col_name = eval_expression(engine_state, stack, col)?.as_string()?;
|
||||
let pos = record.cols.iter().position(|c| c == &col_name);
|
||||
let pos = record.index_of(&col_name);
|
||||
match pos {
|
||||
Some(index) => {
|
||||
return Err(ShellError::ColumnDefinedTwice {
|
||||
@ -592,10 +592,7 @@ pub fn eval_expression(
|
||||
row.push(eval_expression(engine_state, stack, expr)?);
|
||||
}
|
||||
output_rows.push(Value::record(
|
||||
Record {
|
||||
cols: output_headers.clone(),
|
||||
vals: row,
|
||||
},
|
||||
Record::from_raw_cols_vals(output_headers.clone(), row),
|
||||
expr.span,
|
||||
));
|
||||
}
|
||||
|
Reference in New Issue
Block a user