Properly format partial VRP output.
@@ -77,12 +77,11 @@ impl OutputFormat {
target: &mut W,
) -> Result<(), io::Error> {
self.output_header(vrps, target)?;
- let mut iter = vrps.iter();
- if let Some(vrp) = iter.next() {
- self.output_origin(vrp, filters, true, target)?;
+ let mut first = true;
+ for vrp in vrps.iter() {
+ if self.output_origin(vrp, filters, first, target)? {
+ first = false;
}
- for vrp in iter {
- self.output_origin(vrp, filters, false, target)?;
}
self.output_footer(vrps, target)
}
