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 {
|
if line == "---" && !header_consumed {
|
||||||
header_consumed = true;
|
header_consumed = true;
|
||||||
// do not further process the line
|
// do not further process the line
|
||||||
} else {
|
} else if !header_consumed {
|
||||||
if !header_consumed {
|
|
||||||
let _ = writeln!(header, "{}", line)?;
|
let _ = writeln!(header, "{}", line)?;
|
||||||
} else {
|
} else if iter.peek().is_some() {
|
||||||
if iter.peek().is_some() {
|
|
||||||
let _ = writeln!(content, "{}", line)?;
|
let _ = writeln!(content, "{}", line)?;
|
||||||
} else {
|
} else {
|
||||||
let _ = write!(content, "{}", line)?;
|
let _ = write!(content, "{}", line)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok((Value::parse(&header)?, String::from(content)))
|
Ok((Value::parse(&header)?, String::from(content)))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue