Skip to content

Commit

Permalink
Squash into simplifications commit
Browse files Browse the repository at this point in the history
Co-authored-by: Daira Emma Hopwood <[email protected]>
  • Loading branch information
str4d and daira authored Jul 18, 2023
1 parent 345de6c commit 4b9b1de
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions zcash_client_sqlite/src/wallet/scanning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ fn join_nonoverlapping(left: ScanRange, right: ScanRange) -> Joined {
);

match join_nonoverlapping(left, gap) {
Joined::One(left) => join_nonoverlapping(left, right),
Joined::One(merged) => join_nonoverlapping(merged, right),
Joined::Two(left, gap) => match join_nonoverlapping(gap, right) {
Joined::One(right) => Joined::Two(left, right),
Joined::One(merged) => Joined::Two(left, merged),
Joined::Two(gap, right) => Joined::Three(left, gap, right),
_ => unreachable!(),
},
Expand Down Expand Up @@ -232,9 +232,9 @@ fn insert(current: ScanRange, to_insert: ScanRange) -> Joined {
left.truncate_end(right.block_range().start),
left.truncate_start(right.block_range().end),
) {
(Some(left), Some(end)) => Joined::Three(left, right, end),
(Some(left), None) => Joined::Two(left, right),
(None, Some(end)) => Joined::Two(right, end),
(Some(before), Some(after)) => Joined::Three(before, right, after),
(Some(before), None) => Joined::Two(before, right),
(None, Some(after)) => Joined::Two(right, after),
(None, None) => Joined::One(right),
},
}
Expand All @@ -246,7 +246,10 @@ fn insert(current: ScanRange, to_insert: ScanRange) -> Joined {
LeftFirstOverlap | RightContained => join_overlapping(to_insert, current, Insert::Left),
Equal => Joined::One(ScanRange::from_parts(
to_insert.block_range().clone(),
update_priority(current.priority(), to_insert.priority()),
match dominance(current.priority(), to_insert.priority(), Insert::Right) {

Check failure on line 249 in zcash_client_sqlite/src/wallet/scanning.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

arguments to this function are incorrect

error[E0308]: arguments to this function are incorrect --> zcash_client_sqlite/src/wallet/scanning.rs:249:19 | 249 | match dominance(current.priority(), to_insert.priority(), Insert::Right) { | ^^^^^^^^^ ------------------ -------------------- expected `&zcash_client_backend::data_api::scanning::ScanPriority`, found enum `zcash_client_backend::data_api::scanning::ScanPriority` | | | expected `&zcash_client_backend::data_api::scanning::ScanPriority`, found enum `zcash_client_backend::data_api::scanning::ScanPriority` | note: function defined here --> zcash_client_sqlite/src/wallet/scanning.rs:121:4 | 121 | fn dominance(current: &ScanPriority, inserted: &ScanPriority, insert: Insert) -> Dominance { | ^^^^^^^^^ ---------------------- ----------------------- -------------- help: consider borrowing here | 249 | match dominance(&current.priority(), to_insert.priority(), Insert::Right) { | ~~~~~~~~~~~~~~~~~~~ help: consider borrowing here | 249 | match dominance(current.priority(), &to_insert.priority(), Insert::Right) { | ~~~~~~~~~~~~~~~~~~~~~
Dominance::Left | Dominance::Equal => current.priority(),
Dominance::Right => to_insert.priority(),
}
)),
RightFirstOverlap | LeftContained => join_overlapping(current, to_insert, Insert::Right),
RightFirstDisjoint => join_nonoverlapping(current, to_insert),
Expand Down Expand Up @@ -398,7 +401,7 @@ impl SpanningTree {
SpanningTree::Leaf(entry) => {
if let Some(top) = acc.pop() {
match join_nonoverlapping(top, entry) {
Joined::One(entry) => acc.push(entry),
Joined::One(merged) => acc.push(merged),
Joined::Two(l, r) => {
acc.push(l);
acc.push(r);
Expand Down

0 comments on commit 4b9b1de

Please sign in to comment.