Add new lint: manual_assert_matches#17118
Conversation
|
Lintcheck changes for 1f8fa37
This comment will be updated if you push new changes |
There was a problem hiding this comment.
I am not sure you need an early collector pass.
When you check an expression, if it comes from expansion, you can use first_node_macro_backtrace() from clippy_utils::macros to get the succession of macro calls. You can then match them against one of the *assert! macros (see is_assert_macro()), then against matches!() (by checking it is the right diagnostic item). This is much more robust than comparing strings.
|
Reminder, once the PR becomes ready for a review, use |
|
Thank you @samueltardieu! |
This comment has been minimized.
This comment has been minimized.
00ca9c0 to
4de4469
Compare
4de4469 to
17bd309
Compare
|
@rustbot ready |
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @samueltardieu (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
Close #17111
changelog: [
manual_assert_matches]: Add new lint:manual_assert_matches