Repository navigation
fix: iteration - #40
Merged
Merged
Conversation
PastaPastaPasta
left a comment
Member
There was a problem hiding this comment.
LGTM, a couple things for future potential refactoring
| }); | ||
| (valid, next_valid) | ||
| let basic_valid = iter.valid() && iter.key().is_some(); | ||
| let valid = basic_valid && if left_to_right { |
Member
There was a problem hiding this comment.
basic_valid &&
(
(left_to_right && iter.key() <= Some(range_inclusive.end())) ||
iter.key() >= Some(range_inclusive.start())
)
Comment on lines
+473
to
+478
| let valid = basic_valid && if left_to_right { | ||
| true | ||
| } else { | ||
| iter.key() >= Some(start) | ||
| }; | ||
| valid |
Member
There was a problem hiding this comment.
simply
(basic_valid && (left_to_right || iter.key() >= Some(start))
Comment on lines
+484
to
+489
| let valid = basic_valid && if left_to_right { | ||
| iter.key() < Some(end) | ||
| } else { | ||
| true | ||
| }; | ||
| valid |
Comment on lines
+495
to
+500
| let valid = basic_valid && if left_to_right { | ||
| iter.key() <= Some(end) | ||
| } else { | ||
| true | ||
| }; | ||
| valid |
Comment on lines
+506
to
+511
| let valid = basic_valid && if left_to_right { | ||
| true | ||
| } else { | ||
| iter.key() > Some(start) | ||
| }; | ||
| valid |
Comment on lines
+517
to
+522
| let valid = basic_valid && if left_to_right { | ||
| iter.key() < Some(end) | ||
| } else { | ||
| iter.key() > Some(start) | ||
| }; | ||
| valid |
Comment on lines
+528
to
+533
| let valid = basic_valid && if left_to_right { | ||
| iter.key() <= Some(range_inclusive.end()) | ||
| } else { | ||
| iter.key() > Some(range_inclusive.start()) | ||
| }; | ||
| valid |
Comment on lines
+448
to
+453
| let valid = basic_valid && if left_to_right { | ||
| iter.key() < Some(end) | ||
| } else { | ||
| iter.key() >= Some(start) | ||
| }; | ||
| valid |
| collections::BTreeSet, | ||
| ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive}, | ||
| }; | ||
| use std::{cmp::{max, min, Ordering}, cmp, collections::BTreeSet, ops::{Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, RangeToInclusive}}; |
Member
There was a problem hiding this comment.
nit: imo this is worse 🤷
Contributor
There was a problem hiding this comment.
hmm a single cargo fmt will bring it back to normal
fominok
approved these changes
Jan 24, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There were some big issues in iterators, this should fix them.