From e8f08a90d5ddfa0d52c7a60e7c200552b25bf870 Mon Sep 17 00:00:00 2001 From: Erin Date: Sat, 28 Aug 2021 23:52:58 +0200 Subject: [PATCH] Display carts sorted --- ablescript/src/variables.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ablescript/src/variables.rs b/ablescript/src/variables.rs index 3fa3fa0c..544f29f7 100644 --- a/ablescript/src/variables.rs +++ b/ablescript/src/variables.rs @@ -427,9 +427,11 @@ impl Display for Value { }, Value::Cart(c) => { write!(f, "[")?; + let mut cart_vec = c.into_iter().collect::>(); + cart_vec.sort_by(|x, y| x.0.partial_cmp(&y.0).unwrap_or(std::cmp::Ordering::Less)); - for (key, value) in c { - write!(f, "{} <= {},", value.borrow(), key)?; + for (key, value) in cart_vec { + write!(f, "{} <= {}, ", value.borrow(), key)?; } write!(f, "]")