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: Extract Function produces duplicate fn names #12662

Conversation

DorianListens
Copy link
Contributor

@DorianListens DorianListens commented Jul 1, 2022

This change fixes #10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.

@Veykril
Copy link
Member

Veykril commented Jul 2, 2022

@bors delegate+

@bors
Copy link
Collaborator

bors commented Jul 2, 2022

✌️ @DorianListens can now approve this pull request

@DorianListens DorianListens force-pushed the dscheidt/extract-function-duplicate-name branch 2 times, most recently from 7ea60b0 to 407d525 Compare July 2, 2022 19:21
This change fixes issue rust-lang#10037, in more or less the most naive fashion
possible.

We continue to start with the hardcoded default of "fun_name", and now append a
counter to the end of it if that name is already in scope.

In the future, we can probably apply more heuristics here to wind up with more
useful names by default, but for now this resolves the immediate problem.
@DorianListens DorianListens force-pushed the dscheidt/extract-function-duplicate-name branch from 407d525 to 0039d6f Compare July 2, 2022 19:25
@DorianListens
Copy link
Contributor Author

Thanks @Veykril

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 2, 2022

📌 Commit 0039d6f has been approved by DorianListens

@bors
Copy link
Collaborator

bors commented Jul 2, 2022

⌛ Testing commit 0039d6f with merge cc0bb71...

@bors
Copy link
Collaborator

bors commented Jul 2, 2022

☀️ Test successful - checks-actions
Approved by: DorianListens
Pushing cc0bb71 to master...

@bors bors merged commit cc0bb71 into rust-lang:master Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extract to function assist creates duplicate function definitions
3 participants