Skip to content

feat: Allow crate authors to declare that their trait prefers to be imported as _#21740

Open
ChayimFriedman2 wants to merge 1 commit intorust-lang:masterfrom
ChayimFriedman2:prefer-underscore-import
Open

feat: Allow crate authors to declare that their trait prefers to be imported as _#21740
ChayimFriedman2 wants to merge 1 commit intorust-lang:masterfrom
ChayimFriedman2:prefer-underscore-import

Conversation

@ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Mar 4, 2026

For example for extension traits.

Provide an attribute for that. It'll affect flyimport and the autoimport quickfix, as explained in the code.

The origin of this is me being angry at the next solver traits that have names identical to the types and make autoimport a nightmare, especially in completion. Then in general we don't do a good job for traits that would be better of imported as _, I at least leave them imported normally because it's more convenient for flyimport. So this fixes that.

…d `as _`

For example for extension traits.

Provide an attribute for that. It'll affect flyimport and the autoimport quickfix, as explained in the code.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 4, 2026
@@ -1,5 +1,5 @@
<!---
lsp/ext.rs hash: 235f56089da3dbb5
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file didn't contain info about CompletionImport at all, so I just updated the hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants