Collapse nested if-else-if

This commit is contained in:
Matthias Beyer 2018-04-24 21:07:10 +02:00
parent 67675b2ab2
commit dc18e650bb

View file

@ -52,16 +52,12 @@ pub fn entry_buffer_to_header_content(buf: &str) -> Result<(Value, String)> {
if line == "---" && !header_consumed { if line == "---" && !header_consumed {
header_consumed = true; header_consumed = true;
// do not further process the line // do not further process the line
} else if !header_consumed {
let _ = writeln!(header, "{}", line)?;
} else if iter.peek().is_some() {
let _ = writeln!(content, "{}", line)?;
} else { } else {
if !header_consumed { let _ = write!(content, "{}", line)?;
let _ = writeln!(header, "{}", line)?;
} else {
if iter.peek().is_some() {
let _ = writeln!(content, "{}", line)?;
} else {
let _ = write!(content, "{}", line)?;
}
}
} }
} }