refactor: remove uses of Option
in new_with_config()
#978
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 passNone
asconfig
which (imho) is just noise.thus, this PR
new_with_config()
which takes&Config
instead 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 of
Option<&Config>`, which simplifies the logicmodule_test()
to "with config" and "without config" versions, which removes theNone
parameter 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.