Skip to content

Commit

Permalink
fix display trait
Browse files Browse the repository at this point in the history
  • Loading branch information
neotheprogramist committed Dec 26, 2023
1 parent 8d8f16c commit 733b535
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion runner/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,20 @@ impl Display for Expr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expr::Value(v) => write!(f, "{v}"),
Expr::Array(v) => write!(f, "{v:?}"),
Expr::Array(v) => {
write!(f, "[")?;

for (i, expr) in v.iter().enumerate() {
if i != 0 {
write!(f, ", ")?;
}
write!(f, "{expr}")?;
}

write!(f, "]")?;

Ok(())
},
}
}
}
Expand Down

0 comments on commit 733b535

Please sign in to comment.