sum_tree: Store context on cursor (#34904)

This gets rid of the need to pass context to all cursor functions. In
practice context is always immutable when interacting with cursors.

A nicety of this is in the follow-up PR we will be able to implement
Iterator for all Cursors/filter cursors (hell, we may be able to get rid
of filter cursor altogether, as it is just a custom `filter` impl on
iterator trait).
Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-07-22 18:20:48 +02:00 committed by GitHub
parent fa3e1ccc37
commit 64d0fec699
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 749 additions and 876 deletions

View file

@ -4279,7 +4279,7 @@ impl Repository {
for (repo_path, status) in &*statuses.entries {
changed_paths.remove(repo_path);
if cursor.seek_forward(&PathTarget::Path(repo_path), Bias::Left, &()) {
if cursor.seek_forward(&PathTarget::Path(repo_path), Bias::Left) {
if cursor.item().is_some_and(|entry| entry.status == *status) {
continue;
}
@ -4292,7 +4292,7 @@ impl Repository {
}
let mut cursor = prev_statuses.cursor::<PathProgress>(&());
for path in changed_paths.into_iter() {
if cursor.seek_forward(&PathTarget::Path(&path), Bias::Left, &()) {
if cursor.seek_forward(&PathTarget::Path(&path), Bias::Left) {
changed_path_statuses.push(Edit::Remove(PathKey(path.0)));
}
}