mirror of https://github.com/zkat/miette.git
use std::cmp::max instead of manual calculation
This commit is contained in:
parent
36f7f65f87
commit
b1e2bd2563
|
|
@ -405,16 +405,12 @@ impl GraphicalReportHandler {
|
|||
// The snippets will overlap, so we create one Big Chunky Boi
|
||||
let left_end = left.offset() + left.len();
|
||||
let right_end = right.offset() + right.len();
|
||||
let new_end = std::cmp::max(left_end, right_end);
|
||||
|
||||
let new_span = LabeledSpan::new(
|
||||
left.label().map(String::from),
|
||||
left.offset(),
|
||||
if right_end >= left_end {
|
||||
// Right end goes past left end
|
||||
right_end - left.offset()
|
||||
} else {
|
||||
// right is contained inside left
|
||||
left.len()
|
||||
},
|
||||
new_end - left.offset(),
|
||||
);
|
||||
// Check that the two contexts can be combined
|
||||
if let Ok(new_conts) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue