Switch from comparison to is_empty()

This commit is contained in:
Daniel Lockyer 2017-03-30 12:39:46 +01:00
parent de940a3373
commit 50714395c2

View file

@ -148,7 +148,7 @@ impl<'a, 'b> de::Deserializer for &'b mut Deserializer<'a> {
while let Some(line) = self.line()? { while let Some(line) = self.line()? {
match line { match line {
Line::Table { at, mut header, array } => { Line::Table { at, mut header, array } => {
if cur_table.header.len() > 0 || cur_table.values.is_some() { if !cur_table.header.is_empty() || cur_table.values.is_some() {
tables.push(cur_table); tables.push(cur_table);
} }
cur_table = Table { cur_table = Table {
@ -175,7 +175,7 @@ impl<'a, 'b> de::Deserializer for &'b mut Deserializer<'a> {
} }
} }
} }
if cur_table.header.len() > 0 || cur_table.values.is_some() { if !cur_table.header.is_empty() || cur_table.values.is_some() {
tables.push(cur_table); tables.push(cur_table);
} }
@ -1095,7 +1095,7 @@ impl fmt::Display for Error {
ErrorKind::__Nonexhaustive => panic!(), ErrorKind::__Nonexhaustive => panic!(),
} }
if self.inner.key.len() > 0 { if !self.inner.key.is_empty() {
write!(f, " for key `")?; write!(f, " for key `")?;
for (i, k) in self.inner.key.iter().enumerate() { for (i, k) in self.inner.key.iter().enumerate() {
if i > 0 { if i > 0 {