-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
New Lint: disallowed_method #6081
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @matthiaskrgr (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
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.
Hi, thanks for the patch!
Some notes:
If you add "Fixes #6073" to pr description, the linked ticket will auto-close once the pr is merged.
The "changelog: none" line at bottom will later be used to auto-generate a changelog for clippy.
It should read something like "changelog: Add disallowed_method lint to warn on user-defined method calls" or something like that. :)
We try to keep merge commits to a minimum which is why we rebase branches instead of merging master into them.
Sorry for the force push, is it OK that I removed the useless tests since I removed the default values? |
The issues should be resolved |
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.
LGTM!
Thanks! |
📌 Commit 5f7b643 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #6073
I added a
disallowed_method
lint that works similar toblacklisted_name
, e.g allows config-defined disallowed method calls.This lint allows advanced users to patch in undesired method calls for specific projects. It basically uses the DefId of method calls and matches it to parsed strings. Is there an alternative approach that could use more easily digestible configuration strings?
All tests pass as expected except for a linting error on
ui/redundant_pattern_matching_option
, which I am not sure how to resolve since I don't think I changed anything affecting it.changelog: Add disallowed_method lint to warn on user-defined method calls