Skip to content

Conversation

Alexhuszagh
Copy link
Contributor

Allows us to differentiate between an empty array and an array that was not provided when merging config files.

#754 (comment)

Required for #754.

@Alexhuszagh Alexhuszagh added the no changelog A valid PR without changelog (no-changelog) label Jun 15, 2022
@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 15, 2022 18:04
@Alexhuszagh
Copy link
Contributor Author

If we use optional variables for config options, then this is required for us to be able to differentiate if a variable is provided and empty, or simply not provided.

For example, if we have:

[build.env]
passthrough = []

We currently cannot differentiate it from:

[build.env]

When merging, this means we do not know if we need to overwrite the value, or not. What this does is it changes all Vec<String> variables in the config file to Option<Vec<String>>, which then us to differentiate the two when merging config files.

@Alexhuszagh
Copy link
Contributor Author

Both resolved, I made it so there's an if let Some(Some(..)) = ..., which seems to have worked better than I imagined it to.

Allows us to differentiate between an empty array and an array that was
not provided when merging config files.

cross-rs#754 (comment)

Required for cross-rs#754.
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@bors
Copy link
Contributor

bors bot commented Jun 15, 2022

Build succeeded:

@bors bors bot merged commit d6d9e66 into cross-rs:main Jun 15, 2022
@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 16, 2022
@Alexhuszagh Alexhuszagh deleted the config_array branch June 23, 2022 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog A valid PR without changelog (no-changelog)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants