Keep builder state when a property is None#11
Open
pojntfx wants to merge 1 commit into
Open
Conversation
Signed-off-by: Felicitas Pojtinger <felicitas@pojtinger.com>
adzialocha
reviewed
May 5, 2026
Member
There was a problem hiding this comment.
I'm not a glib expert but I think this looks good!
From a Rust perspective you could do an early return for value right at the beginning before you go into the match statement, something like that:
let Some(value) = value else {
return builder
};Now you can assume that value will always be Some for all code coming after.
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.
With the current state on
main, if you pass in a property asNone, the whole builder gets overwritten. This PR changes that so in the case where a property isNone, we just return the builder unchanged.This fixes connecting to a bootstrap node - with the state on
main, if you disable mDNS and connect via a bootstrap node, nothing ever connects otherwise since everyNoneargument would wipe all preceding arguments, e.g. the bootstrap URL.Heads up: My Rust is very rusty, so there might be a better way to do this I'm not aware of?