-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Do not suggest adding a type parameter on multi-letter types #70572
Comments
…bosity, r=davidtwco Do not suggest adding type param when `use` is already suggested Fix rust-lang#70365, cc rust-lang#70572.
I do not know if only triggering for short idents is the best course of action: type params are stylistically one upper-case letter in many languages, but not in all. If you come from Java or TypeScript only triggering on one uppercase letter will be fine, but if you come from Scala, C++ or C# you would expect We no longer emit this suggestion when the type is found somewhere and we suggest importing it. I feel it might be enough to close this ticket, but don't know for sure. |
I think that's enough, in particular given #72640 as well. I don't think I've hit this since the import change landed, too, which makes it less of a concern for me. |
In the process of writing some code, I didn't import an enum, resulting in
The import suggestion is great, but suggesting the type parameter seems likely to be confusing (and IMO, is almost certainly wrong). My suggested heuristic is to avoid suggesting the type parameter if we suggest a candidate in another module, at least, and possibly even avoid suggesting it always if there's more than on letter. It also seems suprising to suggest the type parameter on the impl and not the (more local) function?
I can try to come up with a MCVE, but I suspect it's pretty simple and I wanted to just not forget about this.
The text was updated successfully, but these errors were encountered: