Conversation
- Check `WorkspaceDefaultMembers::is_available()` before reading the default members, instead of catching the panic `workspace_default_packages()` raises when Cargo older than 1.71 omits them. - The fallback to testing all packages is unchanged, and unit tests now cover both paths.
Owner
|
Thanks. Out of interest, did you actually hit a bug related to this? Or you just wanted to fix an open bug? |
Author
|
No, I didn't hit it. I picked #474 from the open issues to get to know the codebase. |
This branch has not been deployed
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.
Fixes #474.
default_packageswrappedworkspace_default_packages()incatch_unwindbecause it panics when Cargo older than 1.71 doesn't report default members. cargo_metadata 0.23 hasWorkspaceDefaultMembers::is_available(), so this checks it first and falls back to testing all packages, as before, without the panic.Added unit tests for both paths, using the
workspace_default_membersfixture: one expects the declared default member, the other clears the default members to simulate older Cargo and expects all packages. The fallback test fails with thecargo_metadatapanic if the check is removed.cargo test --bin cargo-mutants workspace::,cargo fmt --all --checkandcargo clippy --all-targetspass.