Do some str collect cleanup (#312)

This commit is contained in:
JT
2021-11-09 17:46:26 +13:00
committed by GitHub
parent 47628946b6
commit 34617fabd9
12 changed files with 89 additions and 72 deletions

View File

@ -94,7 +94,7 @@ prints out the list properly."#
let mut items = vec![];
for (i, (c, v)) in cols.into_iter().zip(vals.into_iter()).enumerate() {
items.push((i, c, v.into_string()))
items.push((i, c, v.into_string(", ")))
}
Ok(create_grid_output2(
@ -187,7 +187,7 @@ fn convert_to_list2(iter: impl IntoIterator<Item = Value>) -> Option<Vec<(usize,
let mut row = vec![row_num.to_string()];
if headers.is_empty() {
row.push(item.into_string())
row.push(item.into_string(", "))
} else {
for header in headers.iter().skip(1) {
let result = match item {
@ -201,7 +201,7 @@ fn convert_to_list2(iter: impl IntoIterator<Item = Value>) -> Option<Vec<(usize,
};
match result {
Ok(value) => row.push(value.into_string()),
Ok(value) => row.push(value.into_string(", ")),
Err(_) => row.push(String::new()),
}
}

View File

@ -76,7 +76,7 @@ impl Command for Table {
style: nu_table::TextStyle::default_field(),
},
StyledString {
contents: v.into_string(),
contents: v.into_string(", "),
style: nu_table::TextStyle::default(),
},
])
@ -123,7 +123,7 @@ fn convert_to_table(
let mut row = vec![row_num.to_string()];
if headers.is_empty() {
row.push(item.into_string())
row.push(item.into_string(", "))
} else {
for header in headers.iter().skip(1) {
let result = match item {
@ -137,7 +137,7 @@ fn convert_to_table(
};
match result {
Ok(value) => row.push(value.into_string()),
Ok(value) => row.push(value.into_string(", ")),
Err(_) => row.push(String::new()),
}
}