do not print null values inside list

This commit is contained in:
ConnorSkees 2020-03-31 00:27:00 -04:00
parent 806dba12a3
commit e5b7043480
2 changed files with 7 additions and 0 deletions

View File

@ -57,6 +57,7 @@ impl Display for Value {
f,
"{}",
vals.iter()
.filter(|x| !x.is_null())
.map(std::string::ToString::to_string)
.collect::<Vec<String>>()
.join(sep.as_str()),
@ -65,6 +66,7 @@ impl Display for Value {
f,
"[{}]",
vals.iter()
.filter(|x| !x.is_null())
.map(std::string::ToString::to_string)
.collect::<Vec<String>>()
.join(sep.as_str()),

View File

@ -164,3 +164,8 @@ test!(
"a {\n color: [1,];\n}\n",
"a {\n color: [1];\n}\n"
);
test!(
null_values_in_list_ommitted,
"a {\n color: 1, null, null;;\n}\n",
"a {\n color: 1;\n}\n"
);