Fallback to workspace if workspace_default_members is unavailable #80
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.
NB: Draft because it requires a new release of https://github.com/oli-obk/cargo_metadata (which will include the new API's which can be used to check the presence of the the workspace_default_members field oli-obk/cargo_metadata#282)
When cargo_metadata is invoked with a Cargo version < 1.71, which doesn't support workspace default members, the workspace_default_members field in cargo_metadata will be empty. Dereferencing this field will then cause a panic. To prevent partition_packages to panic when used with older Cargo versions, we check the presence of the field, and if it is missing, we default to the workspace instead.
Do you agree that selecting the workspace, if workspace_default_members is unavailable, would be the right behaviour?
fixes #62
See also: issue oli-obk/cargo_metadata#254 "Don't panic from WorkspaceDefaultMembers?"