Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of empty range #6

Open
qsantos opened this issue Nov 2, 2023 · 1 comment
Open

Fix handling of empty range #6

qsantos opened this issue Nov 2, 2023 · 1 comment

Comments

@qsantos
Copy link
Contributor

qsantos commented Nov 2, 2023

Currently, comparing a value to the empty set yields different results, depending on how it is represented:

        assert_eq!(30.range_cmp(45..35), RangeOrdering::Below);
        assert_eq!(30.range_cmp(25..15), RangeOrdering::Above);

If we want to follow the semantics of the set of values represented by the range, none of these is actually correct, and we should add a new variant for RangeOrdering for this case.

We could also decide that we want to keep this behavior, since the representations 45..35 and 25..15 actually represent different objects.

@qsantos
Copy link
Contributor Author

qsantos commented Nov 2, 2023

Note that ..0u32 is empty. Have fun implementing is_empty over arbitrary RangeBounds.

@adriendellagaspera adriendellagaspera linked a pull request Nov 2, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant