refactor: remove uses of Option in new_with_config()#978
Open
pickx wants to merge 4 commits into
Open
Conversation
Pull Request Test Coverage Report for Build 15656777377Details
💛 - Coveralls |
Owner
|
👋🏼 Thanks @pickx for the changes! I've taken a brief look, I may request some of these be broken out into separate pull requests. Some of the changes I am very much aligned on, while others less so, so I will try to add some comments around different things. |
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.
so this PR is rather large in terms of LoC, and I hope this is something you even want.
if not, that's totally fine and feel free to reject this.
while working on related features, I noticed the following:
new_with_config()function which takesOption<&config::Config>. these functions then proceed to try and read the config in order to parse the values.get_*-or-use-default functions. these all need to handle the case where the config itself isNone. what's more, if the config is indeedNone, the default is chosen for all of them.module_test(), 245 passNoneasconfigwhich (imho) is just noise.thus, this PR
new_with_config()which takes&Configinstead ofOption<&Config>, or "config is unavailable, so use defaults for everything"... in which case I just implDefault::default().get_functions to also take a&Config instead ofOption<&Config>`, which simplifies the logicmodule_test()to "with config" and "without config" versions, which removes theNoneparameter from a whole bunch of existing testsin the "default" implementations, we can also do something that reuses the default values between the "load from config" and "load defaults" constructors, if you'd like.