Currently when calling confy::load or confy::load_path, inside the load_path function the configuration struct's default method is called twice. This may be unwanted for some reasons:
the defaults are fetched from a remote server,
the defaults are a result of a long running calculation,
there are no reasonable defaults and thus user is prompted for input.
I agree that the Default trait maybe shouldn't bother with such cases, but anyhow it seems unnecessary to call default() twice.
This pull request introduces a minor change, i.e. in the load_path function a local variable is set by calling default() once, then a reference is passed to the store() function and the variable is returned to the caller.
Currently when calling confy::load or confy::load_path, inside the load_path function the configuration struct's default method is called twice. This may be unwanted for some reasons:
I agree that the Default trait maybe shouldn't bother with such cases, but anyhow it seems unnecessary to call default() twice.
This pull request introduces a minor change, i.e. in the load_path function a local variable is set by calling default() once, then a reference is passed to the store() function and the variable is returned to the caller.