feat!: Add type-level traversal skip attributes#20
Merged
Conversation
Signed-off-by: tison <wander4096@gmail.com>
Signed-off-by: tison <wander4096@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a clearer split between type-level traversal control (skip visiting the type itself vs. skipping traversal of its children) and child-level skipping on fields/variants, updating documentation and adding derive-behavior tests to validate the new semantics.
Changes:
- Add type-level
#[traverse(skip_self)]and#[traverse(skip_children)]derive attributes and update derive generation accordingly. - Document the attribute split in crate docs and README.
- Add integration tests covering default traversal and the new type-level skip behaviors for both immutable and mutable traversal.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
xtask/src/main.rs |
Updates lint helpers to run fmt/clippy via +nightly. |
traversable/tests/test_derive_attributes.rs |
Adds tests validating new type-level traversal attribute behavior. |
traversable/src/lib.rs |
Updates public documentation to describe the new attribute split. |
traversable-derive/src/lib.rs |
Implements parsing and codegen for skip_self / skip_children at the type level. |
README.md |
Documents the new type-level attributes alongside field/variant skip. |
.github/workflows/ci.yml |
Updates CI runner versions, checkout action version, and toolchain/lint steps. |
Comments suppressed due to low confidence (1)
.github/workflows/ci.yml:68
- In the test matrix job,
Swatinem/rust-cacheruns before the selected toolchain is installed. For consistent cache keys across the matrix (and to avoid restoring artifacts built with a different toolchain), it’s better to install the toolchain first and then runSwatinem/rust-cache.
- uses: actions/checkout@v6
- uses: Swatinem/rust-cache@v2
- name: Delete rust-toolchain.toml
run: rm rust-toolchain.toml
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust-version }}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
#[traverse(skip_self)]and#[traverse(skip_children)]attributes.#[traverse(skip)]scoped to skipping those children.Fixes #17.
Tests
cargo fmt --checkcargo test --workspace --all-featurescargo clippy --workspace --all-features --all-targets -- -D warnings