Skip to content

Conversation

@ada4a
Copy link
Contributor

@ada4a ada4a commented Nov 4, 2025

Resolves #13252
Resurrection of #13333

changelog: [manual_assert_eq]: new lint

@rustbot rustbot added needs-fcp S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Nov 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 4, 2025

r? @Alexendoo

rustbot has assigned @Alexendoo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

Lintcheck changes for 6b87ed6

Lint Added Removed Changed
clippy::manual_assert_eq 140 0 0

This comment will be updated if you push new changes

@ada4a ada4a force-pushed the manual_assert_eq branch 5 times, most recently from 5856d0e to 7ae07b6 Compare November 4, 2025 13:38
Copy link
Member

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

View changes since this review

Comment on lines 42 to 43
&& let macro_name = cx.tcx.item_name(macro_call.def_id)
&& matches!(macro_name, sym::assert | sym::debug_assert)
Copy link
Member

Choose a reason for hiding this comment

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

Why not use this?

Suggested change
&& 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)

Copy link
Contributor Author

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

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties labels Nov 5, 2025
@ada4a
Copy link
Contributor Author

ada4a commented Nov 5, 2025

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties and removed S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) labels Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp 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.

Add lints to encourage use of specialized assert macros

4 participants