mirror of
https://github.com/nushell/nushell.git
synced 2025-08-15 03:02:52 +02:00
Use Record::get
instead of Value
functions (#10925)
# Description Where appropriate, this PR replaces instances of `Value::get_data_by_key` and `Value::follow_cell_path` with `Record::get`. This avoids some unnecessary clones and simplifies the code in some places.
This commit is contained in:
@ -402,15 +402,15 @@ fn html_table(table: Vec<Value>, headers: Vec<String>, config: &Config) -> Strin
|
||||
|
||||
for row in table {
|
||||
let span = row.span();
|
||||
if let Value::Record { .. } = row {
|
||||
if let Value::Record { val: row, .. } = row {
|
||||
output_string.push_str("<tr>");
|
||||
for header in &headers {
|
||||
let data = row.get_data_by_key(header);
|
||||
let data = row
|
||||
.get(header)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| Value::nothing(span));
|
||||
output_string.push_str("<td>");
|
||||
output_string.push_str(&html_value(
|
||||
data.unwrap_or_else(|| Value::nothing(span)),
|
||||
config,
|
||||
));
|
||||
output_string.push_str(&html_value(data, config));
|
||||
output_string.push_str("</td>");
|
||||
}
|
||||
output_string.push_str("</tr>");
|
||||
|
Reference in New Issue
Block a user