Make 'complete' available to procmacro's output by conversion to module #135
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.
This PR converts
complete
from a separate crate to a module, and makes it available viapub mod complete
. This way, callers can use e.g.uutils_args::complete::Value
without having to declare an additional dependency on the (former)uutils_args_complete
crate.Background: Using a proc-macro like
#[derive(Arguments)]
injects code that is evaluated in the context of the destination crate. In some cases, the proc-macros inderive
inject a direct access to something in the (former) crateuutils_args_complete
. This doesn't work if the destination crate doesn't add it as an explicit dependency, leading to compilation errors:There are multiple ways to resolve this issue:
complete
somehow available through uutils-args itself, e.g. at the pathuutils_args::complete::*
, and use that path when injecting code in our derive macro.There are two ways to make it available:
pub extern crate uutils_args_complete as complete;
or some abomination like that.complete
a separate crate, and merge it as a module. This gets rid of some redundant metadata, and simplifies the structure, in my eyes.This PR uses Option 2b. In fact, since #131 makes
complete
a non-optional dependency anyway, I don't see a point in keeping it a separate crate.Most changes are very boring:
s/::uutils_args_complete/::uutils_args::complete/g
and within the (former) cratecomplete
, the stringcrate::
becomescrate::complete::
. The rest is just formatting. That's it.