refactor(app::Help): Use map.values() and don't do if !foo when there is an else

This commit is contained in:
tormol 2016-10-04 19:06:43 +02:00
parent 7455d73404
commit 9679713a30

View file

@ -183,11 +183,11 @@ impl<'a> Help<'a> {
}
let mut first = true;
for arg in arg_v {
if !first {
try!(self.writer.write(b"\n"));
} else {
if first {
first = false;
};
} else {
try!(self.writer.write(b"\n"));
}
try!(self.write_arg(arg.as_base(), longest));
}
Ok(())
@ -212,12 +212,12 @@ impl<'a> Help<'a> {
}
}
let mut first = true;
for (_, btm) in ord_m {
for btm in ord_m.values() {
for arg in btm.values() {
if !first {
try!(self.writer.write(b"\n"));
} else {
if first {
first = false;
} else {
try!(self.writer.write(b"\n"));
}
try!(self.write_arg(arg.as_base(), longest));
}
@ -616,12 +616,12 @@ impl<'a> Help<'a> {
}
let mut first = true;
for (_, btm) in ord_m {
for btm in ord_m.values() {
for sc in btm.values() {
if !first {
try!(self.writer.write(b"\n"));
} else {
if first {
first = false;
} else {
try!(self.writer.write(b"\n"));
}
try!(self.write_arg(sc, longest));
}