Support running bevy_lint_driver
without the rustc
path
#511
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.
Problem
Right now,
bevy_lint_driver
expects itself to be called like:It expects its first argument to be the path to
rustc
, as that's what Cargo passes to it. This, however, can lead to confusion when a normal user tries to runbevy_lint_driver
as if it wererustc
:Unbeknownst to them,
bevy_lint_driver
silently ate--version
because it thought it was the path torustc
. Instead, the user should have run:This behavior is problematic because it's undocumented and breaks our UI tests, forcing us to use a workaround.
Solution
The path to
rustc
is now optional. If it is not specified,bevy_lint_driver
assume it is simply the string"rustc"
and fill it in for you. This means this now works:I use some optimized slice trickery to avoid reallocations when performing this adjustment, so the implementation isn't as simple as described. With this change, we can finally remove the
ui_test
hack, which is super nice!I still wouldn't recommend using
bevy_lint_driver
directly as a user, which is why it's not documented much, but this removes one of its sharp edges.