Avoid trailing comma in cart printout

pull/2/head
Alex Bethel 2021-11-27 11:11:03 -06:00
parent b59b165c1c
commit 145a7efbcf
1 changed files with 8 additions and 2 deletions

View File

@ -532,8 +532,14 @@ impl Display for Value {
let mut cart_vec = c.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 cart_vec {
write!(f, "{} <= {}, ", value.borrow(), key)?;
for (idx, (key, value)) in cart_vec.into_iter().enumerate() {
write!(
f,
"{}{} <= {}",
if idx != 0 { ", " } else { "" },
value.borrow(),
key
)?;
}
write!(f, "]")