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
Copy Markdown
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.

@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
Copy Markdown
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.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

Can this be reviewed please? I'd like to use this for the solver's trait.

@rustbot

This comment has been minimized.

…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.
@ChayimFriedman2 ChayimFriedman2 force-pushed the prefer-underscore-import branch from 484e8b2 to beda061 Compare April 9, 2026 09:08
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 9, 2026

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

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