From f90bfb88ca2abfdfc1661a514aa7b36462f2fc20 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 19 Feb 2017 01:17:54 -0800 Subject: [PATCH] Fix display of list --- src/schala_lang/parser.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/schala_lang/parser.rs b/src/schala_lang/parser.rs index bce4ad4..a5da526 100644 --- a/src/schala_lang/parser.rs +++ b/src/schala_lang/parser.rs @@ -94,11 +94,15 @@ impl fmt::Display for Expression { write!(f, "«function: {}, {} arg(s)»", name, parameters.len()) } ListLiteral(ref items) => { - write!(f, "["); - for item in items { - write!(f, ", {}", item); + write!(f, "[ "); + let mut iter = items.iter().peekable(); + while let Some(item) = iter.next() { + write!(f, "{}", item); + if let Some(_) = iter.peek() { + write!(f, ", "); + } } - write!(f, "]") + write!(f, " ]") } _ => write!(f, "UNIMPLEMENTED"), }