New lint: [self_named_constructor]#7403
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Manishearth (or someone else) soon. Please see the contribution instructions for more information. |
|
Lint name idea: |
That's a better name, I will update the diff. |
|
☔ The latest upstream changes (presumably #7400) made this pull request unmergeable. Please resolve the merge conflicts. |
| impl_item.span, | ||
| &format!("constructor `{}` has the same name as the type", impl_item.ident.name), | ||
| |diag| { | ||
| diag.span_help(impl_item.span, &format!("consider renaming `{}()` to `new()`", impl_item.ident.name)); |
There was a problem hiding this comment.
This message will be bogus if the new method is already present in the implementation.
There was a problem hiding this comment.
I got rid of it for now, since it felt like the action needed to resolve the lint was pretty self explanatory. Let me know if it is better to leave a message, and to check for the existence of new first.
2481835 to
06e94a2
Compare
|
@Manishearth, what will you say? |
|
☔ The latest upstream changes (presumably #7243) made this pull request unmergeable. Please resolve the merge conflicts. |
7cc863b to
357a8f0
Compare
redundant_method_names]self_named_constructor]
|
@bors r+ sorry about the delay! |
|
📌 Commit 357a8f0 has been approved by |
New lint: [`self_named_constructor`] Adds the `self_named_constructor` lint for detecting when an implemented method has the same name as the type it is implemented for. changelog: [`self_named_constructor`] closes: #7142
|
💔 Test failed - checks-action_test |
|
No worries! Just ran |
|
@bors r+ |
|
📌 Commit e9e10d2 has been approved by |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Adds the
self_named_constructorlint for detecting when an implemented method has the same name as the type it is implemented for.changelog: [
self_named_constructor]closes: #7142