Skip to content

cargo fmt --all from excluded sub-directory still checks parent workspace #13962

@dhardy

Description

@dhardy

Problem

Here I run tests on an exclude-d sub-directory, benches. CI kept failing until I removed the --all from cargo fmt due to issues with other workspace members, which should not be checked from here.

Cargo.toml looks like this:

[workspace]
members = [
    "rand_jitter",
    "rand_isaac",
    "rand_xorshift",
    "rand_xoshiro",
    "rand_hc",
]
exclude = [
    "benches",
]
resolver = "2"

Therefore, cargo test -p benches from the repo root fails (expected).

However, this succeeds:

$ cd benches/
$ cargo test -p rand_hc
   Compiling libc v0.2.155

This should fail since benches is, by explicit exclusion, not part of the parent workspace.

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-workspacesArea: workspacesC-bugCategory: bugCommand-fmtS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions