Handle inverted Ranges in add_span

This commit is contained in:
Aapo Alasuutari 2024-02-22 15:53:45 +02:00 committed by Jeremy Soller
parent 8582173128
commit 2766961af6

View file

@ -281,8 +281,8 @@ impl AttrsList {
/// Add an attribute span, removes any previous matching parts of spans
pub fn add_span(&mut self, range: Range<usize>, attrs: Attrs) {
//do not support 1..1 even if by accident.
if range.start == range.end {
//do not support 1..1 or 2..1 even if by accident.
if range.is_empty() {
return;
}