Collapse nested if-else-if
This commit is contained in:
parent
67675b2ab2
commit
dc18e650bb
1 changed files with 5 additions and 9 deletions
|
@ -52,18 +52,14 @@ pub fn entry_buffer_to_header_content(buf: &str) -> Result<(Value, String)> {
|
|||
if line == "---" && !header_consumed {
|
||||
header_consumed = true;
|
||||
// do not further process the line
|
||||
} else {
|
||||
if !header_consumed {
|
||||
} else if !header_consumed {
|
||||
let _ = writeln!(header, "{}", line)?;
|
||||
} else {
|
||||
if iter.peek().is_some() {
|
||||
} else if iter.peek().is_some() {
|
||||
let _ = writeln!(content, "{}", line)?;
|
||||
} else {
|
||||
let _ = write!(content, "{}", line)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok((Value::parse(&header)?, String::from(content)))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue