computate the indentation +1 level once

This commit is contained in:
amtoine 2023-03-11 11:43:15 +01:00
parent ad73c94760
commit 496d45cffa
No known key found for this signature in database
GPG Key ID: 37AAE9B486CFF1AB

View File

@ -102,6 +102,7 @@ pub fn value_to_string(
) -> Result<String, ShellError> { ) -> Result<String, ShellError> {
let nl = get_true_newline(indent); let nl = get_true_newline(indent);
let idt = get_true_indentation(depth, indent); let idt = get_true_indentation(depth, indent);
let idt_po = get_true_indentation(depth + 1, indent);
match v { match v {
Value::Binary { val, .. } => { Value::Binary { val, .. } => {
@ -212,8 +213,7 @@ pub fn value_to_string(
let mut collection = vec![]; let mut collection = vec![];
for val in vals { for val in vals {
collection.push(format!( collection.push(format!(
"{}{}", "{idt_po}{}",
get_true_indentation(depth + 1, indent),
value_to_string_without_quotes(val, span, depth + 1, indent,)? value_to_string_without_quotes(val, span, depth + 1, indent,)?
)); ));
} }