remove uncessary if statement

start > end in all cases.
This commit is contained in:
Benjamin Lee 2023-11-03 23:18:59 -07:00
parent f98876d0cd
commit ad7e5e2921
No known key found for this signature in database
GPG Key ID: FB9624E2885D55A4
1 changed files with 18 additions and 20 deletions

View File

@ -727,26 +727,24 @@ impl GraphicalReportHandler {
let vbar_offset = (start + end) / 2; let vbar_offset = (start + end) / 2;
let num_left = vbar_offset - start; let num_left = vbar_offset - start;
let num_right = end - vbar_offset - 1; let num_right = end - vbar_offset - 1;
if start < end { underlines.push_str(
underlines.push_str( &format!(
&format!( "{:width$}{}{}{}",
"{:width$}{}{}{}", "",
"", chars.underline.to_string().repeat(num_left),
chars.underline.to_string().repeat(num_left), if hl.len() == 0 {
if hl.len() == 0 { chars.uarrow
chars.uarrow } else if hl.label().is_some() {
} else if hl.label().is_some() { chars.underbar
chars.underbar } else {
} else { chars.underline
chars.underline },
}, chars.underline.to_string().repeat(num_right),
chars.underline.to_string().repeat(num_right), width = start.saturating_sub(highest),
width = start.saturating_sub(highest), )
) .style(hl.style)
.style(hl.style) .to_string(),
.to_string(), );
);
}
highest = std::cmp::max(highest, end); highest = std::cmp::max(highest, end);
(hl, vbar_offset) (hl, vbar_offset)