Display carts sorted

pull/2/head
ondra05 2021-08-28 23:52:58 +02:00
parent 10327463ac
commit 4c29018809
1 changed files with 4 additions and 2 deletions

View File

@ -427,9 +427,11 @@ impl Display for Value {
},
Value::Cart(c) => {
write!(f, "[")?;
let mut cart_vec = c.into_iter().collect::<Vec<_>>();
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, "]")