Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add method to check whether WorkspaceDefaultMembers has a value #282

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

foresterre
Copy link
Contributor

@foresterre foresterre commented Dec 10, 2024

This method checks whether the called cargo-metadata supports reading the workspace default members, which is false for versions of Cargo prior to 1.71

Alternatively, I could:

  • add an Option variant method like workspace_default_packages directly on Metadata: pub fn workspace_default_packages(&self) -> Option<Vec<&Package>>, or
  • reverse the name from is_available to is_missing (which would also allow the removal of the doc(hidden) function workspace_default_members_is_missing).

fixes #254

@oli-obk
Copy link
Owner

oli-obk commented Dec 10, 2024

  • reverse the name from is_available to is_missing (which would also allow the removal of the doc(hidden) function workspace_default_members_is_missing).

is this test usually going to be used as if !foo.is_available() {...} or as if foo.is_available() {}? Oh to be honest we could just add both, just like Option has is_none and is_some.

@foresterre foresterre force-pushed the workspace-default-members branch 2 times, most recently from 0fa5f7e to 46e8e0a Compare December 10, 2024 21:11
This method checks whether the called cargo-metadata supports reading the workspace default members, which is false for versions of Cargo prior to 1.71
@foresterre foresterre force-pushed the workspace-default-members branch from 46e8e0a to cdf4223 Compare December 10, 2024 21:12
@foresterre
Copy link
Contributor Author

I've updated the PR to include both.

I've also removed the doc(hidden) workspace_default_members_is_missing, which is no longer necessary when the is_missing variant exists. It was both marked hidden and noted that it "might be removed in the future". Are you okay with its removal?

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.

Don't panic from WorkspaceDefaultMembers?
2 participants