Skip to content

Add a lint for combined equality assertions - #17553

Draft
aryansk wants to merge 3 commits into
rust-lang:masterfrom
aryansk:codex/issue-1810-assert-multiple
Draft

Add a lint for combined equality assertions#17553
aryansk wants to merge 3 commits into
rust-lang:masterfrom
aryansk:codex/issue-1810-assert-multiple

Conversation

@aryansk

@aryansk aryansk commented Aug 12, 2026

Copy link
Copy Markdown

Fixes #1810

changelog: [assert_multiple]: Add a lint for assertions with multiple equality comparisons

Summary

  • add the nursery assert_multiple lint for assert! and debug_assert! calls combining two equality comparisons with &&
  • suggest separate assert_eq!/assert_ne! calls when all operands implement Debug
  • skip custom assertion messages and non-Debug operands to avoid changing output or producing invalid suggestions
  • add UI coverage and register the lint in the generated lint list

Validation

  • cargo fmt --all -- --check
  • git diff --check
  • Clippy UI compilation was not available locally because this checkout lacks the rustc-dev compiler components; upstream CI is required for compiler and UI validation.

Prepared with AI assistance; I reviewed the implementation and validation output.

@rustbot rustbot added the needs-fcp PRs that add, remove, or rename lints and need an FCP label Aug 12, 2026
@aryansk
aryansk force-pushed the codex/issue-1810-assert-multiple branch from d432537 to 70f11b0 Compare August 12, 2026 18:27
@aryansk
aryansk force-pushed the codex/issue-1810-assert-multiple branch from 70f11b0 to 452e2c4 Compare August 12, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp PRs that add, remove, or rename lints and need an FCP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extensions to should_assert_eq

2 participants