-
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
Borrow/BorrowMut auto importing completions are confusing for newcomers #13786
Comments
Making it harder to accidentally autoimport BorrowMut or other traits shadowing inherent methods is one thing (I think we should complete a qualified method call with the full qualified path in such cases, and maybe even more importantly downrank that completion heavily). Maybe we can also do something for the case where someone already imported BorrowMut though? At least we should, when completing an inherent method that's shadowed by some trait method, complete the qualified method call. And maybe we could have a note diagnostic with an assist that suggests to remove the import and replace the qualified method call by a normal one. |
So to clarify, I would see the following possible action items:
|
suggestion: rank all completions that do require an import after the ones that don't. this would resolve the it would also resolve the implementation wise, i don't know how the ranking algorithm works, but i suspect these two |
Here someone ended fighting the borrow checker with This issue doesn't even need to have a proper in-depth fix. It's an exceptionally bad footgun for |
People tend to use the autoimporting trait method completion for
borrow
/borrow_mut
when they meant to use the inherent method completion forRefCell
causing confusion as the method now changes meaning.See #8468 (comment) for previous discussions
The text was updated successfully, but these errors were encountered: