Skip to content
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

fix: Temporary fix for remove_unused_imports not handling import aliases correctly #18164

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

ShoyuVanilla
Copy link
Member

Fixes #18129

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 22, 2024
@@ -447,6 +449,11 @@ impl<'a> FindUsages<'a> {
self
}

pub fn with_rename(mut self, rename: Option<&'a Rename>) -> Self {
Copy link
Member

@Veykril Veykril Sep 24, 2024

Choose a reason for hiding this comment

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

This should be a temporary thing. Ideally this would trivially fix itself once we handle renamed uses as proper Definitions. So a FIXME would be nice. #14079

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, that's right. This should be handled as TypeAlias, right? I'll add a comment and modify the commit and PR message

Copy link
Member

Choose a reason for hiding this comment

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

No, not a type alias. The idea is that we will record use foo as bar as their own kind of Definition, Definition::Use whose name would be the rename, effectively treating renaming imports as their own item.

@ShoyuVanilla ShoyuVanilla changed the title fix: Properly handle aliased imports in remove_unused_imports fix: Temporary prevent actually used aliased imports from removed with remove_unused_imports Sep 24, 2024
@ShoyuVanilla ShoyuVanilla changed the title fix: Temporary prevent actually used aliased imports from removed with remove_unused_imports fix: Temporary fix for remove_unused_imports not handling import aliases correctly Sep 24, 2024
@Veykril
Copy link
Member

Veykril commented Sep 24, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 24, 2024

📌 Commit d4de84f has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 24, 2024

⌛ Testing commit d4de84f with merge 2f55a91...

@bors
Copy link
Contributor

bors commented Sep 24, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 2f55a91 to master...

@bors bors merged commit 2f55a91 into rust-lang:master Sep 24, 2024
11 checks passed
@ShoyuVanilla ShoyuVanilla deleted the use-as-alias branch September 24, 2024 15:43
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.

"Remove all unused imports" code action incorrectly removes as aliased imports.
4 participants