-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(manual_assert_eq): new lint #16025
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
base: master
Are you sure you want to change the base?
Conversation
|
r? @Alexendoo rustbot has assigned @Alexendoo. Use |
be6ca8c to
4db706b
Compare
|
Lintcheck changes for 6b87ed6
This comment will be updated if you push new changes |
5856d0e to
7ae07b6
Compare
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.
The suggestion is only valid if the types being compared implement Debug.
clippy_lints/src/manual_assert_eq.rs
Outdated
| && let macro_name = cx.tcx.item_name(macro_call.def_id) | ||
| && matches!(macro_name, sym::assert | sym::debug_assert) |
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.
Why not use this?
| && let macro_name = cx.tcx.item_name(macro_call.def_id) | |
| && matches!(macro_name, sym::assert | sym::debug_assert) | |
| && let Some(macro_name) = cx.tcx.get_diagnostic_name(macro_call.def_id) | |
| && matches!(macro_name, sym::assert_macro | sym::debug_assert_macro) |
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.
That's what the original PR used, and I wasn't sure whether there was substantial difference between the two methods. But looking at its definition, item_name does seem to be more expensive.
Changed it
7ae07b6 to
6b87ed6
Compare
|
@rustbot ready |
Resolves #13252
Resurrection of #13333
changelog: [
manual_assert_eq]: new lint