* Change Rust toolchain channel to stable
Signed-off-by: houseme <housemecn@gmail.com>
* style: apply clippy --fix and cargo fix lint suggestions
Run `cargo clippy --fix --all-targets --all-features` and
`cargo fix --lib --all-targets` across the workspace, then resolve the
remaining warnings by hand:
- collapse needless borrows in `format!` args, prefer `?` over explicit
early returns, and use `.values()` / `.flatten()` iterator adapters
- rewrite the `Md5` scan loop via `manual_flatten` and re-indent the
`select!` macro body (rustfmt skips macro interiors)
- annotate the intentional dead-code `Md5` inherent methods (constructed
only by the test factory) with `#[allow(dead_code)]`
Behavior is unchanged.
Co-Authored-By: heihutu <heihutu@gmail.com>
---------
Signed-off-by: houseme <housemecn@gmail.com>
Co-authored-by: heihutu <heihutu@gmail.com>
* fix(scanner,data-usage): fix add() logic inversion and usize underflow in reduce_children_of
Bug #1: add() had inverted logic — returned early when children were present,
making the recursive child traversal dead code. Leaf compaction path was
completely non-functional. Fixed by recursing into children when present and
collecting leaves only at leaf nodes.
Bug #2: reduce_children_of used which underflows in debug
(panic) or release (wraps to usize::MAX, compacts entire cache). Fixed with
saturating_sub.
Both bugs existed identically in crates/scanner and crates/data-usage.
Added 5 tests covering add() subtree traversal, edge cases, and
reduce_children_of compaction behavior.
Closesrustfs/backlog#652
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: collect internal nodes as compaction candidates, not leaves
The previous fix for add() collected leaf nodes (children empty) as
compaction candidates. This is incorrect: total_children_rec returns 0
for leaves, so compacting them never decrements — the
compaction loop makes no progress.
Collect internal nodes (children non-empty) instead. Compacting an
internal node removes its subtree via delete_recursive, which actually
reduces the total child count. Leaf nodes are skipped since they have
no children to remove.
Updated tests to match the corrected semantics.
* refactor: rename leaves→candidates, add data-usage regression tests
- Rename misleading variable/parameter to in
add() and reduce_children_of() for both crates
- Add 4 regression tests in crates/data-usage covering add() candidate
selection and reduce_children_of() compaction + saturating_sub
* fix: address data usage compaction review feedback
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: houseme <housemecn@gmail.com>