Drop Option wrapper on Manifest target vecs#5336
Closed
dwijnand wants to merge 2 commits intorust-lang:masterfrom
dwijnand:non-opt-target-vecs
Closed
Drop Option wrapper on Manifest target vecs#5336dwijnand wants to merge 2 commits intorust-lang:masterfrom dwijnand:non-opt-target-vecs
dwijnand wants to merge 2 commits intorust-lang:masterfrom
dwijnand:non-opt-target-vecs
Conversation
As opposed to other manifest keys, such as `authors`, where a difference
may be drawn between:
authors = []
and the complete absence of the `authors` key the same cannot be said
for the target keys which are TOML [Array of Tables][1] types for which
the only way to define an empty array is by never defining any element
in it.
[1]: https://github.com/toml-lang/toml#array-of-tables
|
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
Contributor
Author
|
this will clash with my #5335, but that's fine, I was looking to see if it was possible to simplify let at_least_a_single_target_is_listed = toml_targets
.map(|targets| !targets.is_empty())
.unwrap_or(false);to just let at_least_a_single_target_is_listed = !toml_targets.is_empty();feedback very welcome, I'm happy to iterate (and learn). |
was this required by the Option? is & the better practice? feedback welcome
Contributor
|
This is a horrible edge-case, but unfortunately one can do |
Contributor
Author
|
Ah, I see what you mean. And now I understand better where the TOML docs explained that. Shame. |
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.
As opposed to other manifest keys, such as
authors, where a differencemay be drawn between:
and the complete absence of the
authorskey the same cannot be saidfor the target keys which are TOML Array of Tables types for which
the only way to define an empty array is by never defining any element
in it.