Skip to content

feat!: Add type-level traversal skip attributes#20

Merged
tisonkun merged 4 commits into
mainfrom
codex/skip-self-children
Jun 3, 2026
Merged

feat!: Add type-level traversal skip attributes#20
tisonkun merged 4 commits into
mainfrom
codex/skip-self-children

Conversation

@tisonkun

@tisonkun tisonkun commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add type-level #[traverse(skip_self)] and #[traverse(skip_children)] attributes.
  • Keep field and variant #[traverse(skip)] scoped to skipping those children.
  • Document the attribute split and add derive behavior tests for immutable and mutable traversal.

Fixes #17.

Tests

  • cargo fmt --check
  • cargo test --workspace --all-features
  • cargo clippy --workspace --all-features --all-targets -- -D warnings

@tisonkun tisonkun changed the title Add type-level traversal skip attributes feat!: Add type-level traversal skip attributes Jun 3, 2026
Signed-off-by: tison <wander4096@gmail.com>
tisonkun added 2 commits June 3, 2026 20:22
Signed-off-by: tison <wander4096@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-cache runs 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 run Swatinem/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.

Comment thread xtask/src/main.rs
Comment thread xtask/src/main.rs
Comment thread .github/workflows/ci.yml
@tisonkun tisonkun merged commit be5a50f into main Jun 3, 2026
9 checks passed
@tisonkun tisonkun deleted the codex/skip-self-children branch June 3, 2026 12:28
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.

#[traverse(skip)] features

2 participants