Skip to content

fix: iteration - #40

Merged
QuantumExplorer merged 7 commits into
feat/recursiveSubqueriesfrom
fix/iteration
Jan 24, 2022
Merged

QuantumExplorer merged 7 commits into
feat/recursiveSubqueriesfrom
fix/iteration

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

There were some big issues in iterators, this should fix them.

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a couple things for future potential refactoring

Comment thread merk/src/proofs/query/mod.rs Outdated
});
(valid, next_valid)
let basic_valid = iter.valid() && iter.key().is_some();
let valid = basic_valid && if left_to_right {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basic_valid && 
(
    (left_to_right && iter.key() <= Some(range_inclusive.end())) ||
     iter.key() >= Some(range_inclusive.start())
)

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +473 to +478
let valid = basic_valid && if left_to_right {
true
} else {
iter.key() >= Some(start)
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simply

(basic_valid && (left_to_right || iter.key() >= Some(start))

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +484 to +489
let valid = basic_valid && if left_to_right {
iter.key() < Some(end)
} else {
true
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +495 to +500
let valid = basic_valid && if left_to_right {
iter.key() <= Some(end)
} else {
true
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +506 to +511
let valid = basic_valid && if left_to_right {
true
} else {
iter.key() > Some(start)
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +517 to +522
let valid = basic_valid && if left_to_right {
iter.key() < Some(end)
} else {
iter.key() > Some(start)
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread merk/src/proofs/query/mod.rs Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Comment thread merk/src/proofs/query/mod.rs Outdated
Comment on lines +448 to +453
let valid = basic_valid && if left_to_right {
iter.key() < Some(end)
} else {
iter.key() >= Some(start)
};
valid

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify

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}};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: imo this is worse 🤷

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm a single cargo fmt will bring it back to normal

@QuantumExplorer
QuantumExplorer merged commit 5854c33 into feat/recursiveSubqueries Jan 24, 2022
@QuantumExplorer
QuantumExplorer deleted the fix/iteration branch January 24, 2022 12:09
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 this pull request may close these issues.

3 participants