Don't print double newline for --show

This commit is contained in:
Casey Rodarmor 2016-10-06 16:50:31 -07:00
parent f87ecd6154
commit b1d8fdb398

View File

@ -52,8 +52,12 @@ pub struct Recipe<'a> {
impl<'a> Display for Recipe<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
try!(writeln!(f, "{}:", self.name));
for command in self.commands.iter() {
for (i, command) in self.commands.iter().enumerate() {
if i + 1 < self.commands.len() {
try!(writeln!(f, " {}", command));
} {
try!(write!(f, " {}", command));
}
}
Ok(())
}