-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: When renaming self to other name, change callers method method call syntax to assoc fn syntax
#20369
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
feat: When renaming self to other name, change callers method method call syntax to assoc fn syntax
#20369
Conversation
| result | ||
| } | ||
|
|
||
| fn transform_method_call_into_assoc_fn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be code sharing potential here I think. We do have an assist to qualify method calls after all. Might be nice too look into that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to pursue that, but that was not easy. The code there handles more cases and also IMO needs a refactoring, it also dismisses some edges cases especially around macros, and fixing this isn't trivial. In short, while it'll be good to reuse the code, as the state of things is now it's not easy and there's no big overlap between the code. Even after I switched to use the qualify assist code it did not save much lines. So I think it's a good idea in general, but I don't want to block this PR over that.
crates/ide/src/rename.rs
Outdated
| fn import_path_config(&self) -> ImportPathConfig { | ||
| ImportPathConfig { | ||
| prefer_no_std: self.prefer_no_std, | ||
| prefer_prelude: self.prefer_prelude, | ||
| prefer_absolute: self.prefer_absolute, | ||
| allow_unstable: true, | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should rename config maybe just contain an ImportPathConfig? (and overwrite the allow_unstable field on construction)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AssistConfig and DiagnosticsConfig have separate fields, I just copied that.
5724c87 to
ecc9240
Compare
… syntax to assoc fn syntax
ecc9240 to
9d038a9
Compare
Closes #20352.