-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What about placeholders? #1081
Comments
easy, leave it there, the next round of clippy or rustc lints will catch it. We have many lints that will trigger more (other) lints after being fixed |
Meh. |
I mean it, we can't possibly catch all resulting situations. If a lint causes a change in a match arm, two match arms might now be equal. But it's unrealistic to suggest merging the arms after the suggestion without going through rustc again. |
Yes but if we know there is one out of two chances the suggestion might trigger a new warning, maybe we can show that. |
I'd be okay with adding a "Play again?" option after rustfix saved the changes. Actually, it might be a good idea to suggest running
If there was a need for a placeholder I would suggest something like |
So, just a heads up: The |
Clippy has some suggestions that will contain a placeholder. Most of the time they are
..
or_
¹, but fortunately sometimes it is something more useful.Eg. clippy might suggest to replace
for i in 0..vec.len()
byfor <item> in &vec
².useless_let_if_seq
can also suggestlet <mut> foo =
(because checking whether themut
is still needed after our suggestion is actually hard).A nice feature for a tool to replace suggestions automatically would be to ask the user what to write there. For that we might want to mark these placeholders somehow:
<…>
is nice but it has some problems:a < b && c > d
, but< b && c >
is obviously not a placeholder;<item>
above) or might want to remove (<mut>
above).IMO, we should use different characters for placeholder markers such that:
rustfix
to detect placeholders;<item>
and<mut>
.Unicode can help: eg. we could use
‹item›
for something the user should change and❪mut❫
for something the user should opt-in.Some considerations though:
‹›❪❫
work for me™);span_suggestion
today, 2) Clippy suggestions still need a lot of work to be automatically fixable and have a working POC.Cc @killercup.
1: we should kill that btw.
2: and in the future should be able to add a proper suggestion for all the
vec[i]
in the loop as well.The text was updated successfully, but these errors were encountered: