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

New Lint: disallowed_method #6081

Merged
merged 10 commits into from
Sep 26, 2020
Merged

New Lint: disallowed_method #6081

merged 10 commits into from
Sep 26, 2020

Conversation

ilknarf
Copy link
Contributor

@ilknarf ilknarf commented Sep 24, 2020

Fixes #6073

I added a disallowed_method lint that works similar to blacklisted_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

@rust-highfive
Copy link

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 24, 2020
Copy link
Member

@matthiaskrgr matthiaskrgr left a 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.

clippy_lints/src/disallowed_method.rs Outdated Show resolved Hide resolved
clippy_lints/src/disallowed_method.rs Outdated Show resolved Hide resolved
clippy_lints/src/disallowed_method.rs Outdated Show resolved Hide resolved
clippy_lints/src/utils/conf.rs Outdated Show resolved Hide resolved
clippy_lints/src/disallowed_method.rs Outdated Show resolved Hide resolved
@ilknarf
Copy link
Contributor Author

ilknarf commented Sep 25, 2020

Sorry for the force push, is it OK that I removed the useless tests since I removed the default values?

@ilknarf
Copy link
Contributor Author

ilknarf commented Sep 26, 2020

The issues should be resolved

Copy link
Member

@matthiaskrgr matthiaskrgr left a comment

Choose a reason for hiding this comment

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

LGTM!

@matthiaskrgr
Copy link
Member

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Sep 26, 2020

📌 Commit 5f7b643 has been approved by matthiaskrgr

@bors
Copy link
Contributor

bors commented Sep 26, 2020

⌛ Testing commit 5f7b643 with merge ea079eb...

@bors
Copy link
Contributor

bors commented Sep 26, 2020

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: matthiaskrgr
Pushing ea079eb to master...

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.

New Lint: blacklisted_method
5 participants