checks that debug, error, info, trace, warn ranges don't overlap
this is not a fix for an issue I had, just noticed this while reading
the code and did it for no reason ;)
@@ -50,7 +50,15 @@ impl Table {
));
}
- // TODO check that the ranges don't overlap
+ let mut ranges = [&debug, &error, &info, &trace, &warn];
+ ranges.sort_by(|a, b| a.start.cmp(&b.start));
+ for i in 0..ranges.len() - 1 {
+ if ranges[i].contains(&ranges[i + 1].start) {
+ return Err(
+ "one or more of debug, error, info, trace, warn ranges overlap".to_string(),
+ );
+ }
+ }
Ok(Self {
entries,
