Collapse nested if-else-if
This commit is contained in:
parent
67675b2ab2
commit
dc18e650bb
1 changed files with 5 additions and 9 deletions
|
@ -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)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue