Deduplicate markers during normalization (#4263)

## Summary

We need to sort _before_ deduplicating; otherwise, we can't detect
adjacent elements, so we aren't guaranteed to deduplicate anything.
This commit is contained in:
Charlie Marsh 2024-06-11 19:38:15 -07:00 committed by GitHub
parent cc2e9ec111
commit 8a8e1af513
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -123,8 +123,8 @@ pub(crate) fn normalize(tree: &mut MarkerTree) {
.fold(PubGrubRange::full(), |acc, range| acc.intersection(range))
});
reduced.dedup();
reduced.sort();
reduced.dedup();
*tree = match reduced.len() {
1 => reduced.remove(0),
@ -138,8 +138,8 @@ pub(crate) fn normalize(tree: &mut MarkerTree) {
.fold(PubGrubRange::empty(), |acc, range| acc.union(range))
});
reduced.dedup();
reduced.sort();
reduced.dedup();
*tree = match reduced.len() {
1 => reduced.remove(0),