Skip to content

fix: ignore pattern_type_mismatch when external macro owns the match #15306

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kristof-mattei
Copy link
Contributor

@kristof-mattei kristof-mattei commented Jul 17, 2025

Don't trigger the ignore_type_mismatch lint when the match scrutinee is generated by a macro.

If the macro generates

match &scrutinee {
    _ => {},
    () => {},
}

We don't expect it to hit on ().

Rust Playground example:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=b23aca42440f006660bd7440d02db196

changelog: [pattern_type_mismatch]: fix unwanted hit in external macro

changelog: [`pattern_type_mismatch`]: fix unwanted hit in external macro
@kristof-mattei kristof-mattei marked this pull request as ready for review July 17, 2025 23:53
@rustbot
Copy link
Collaborator

rustbot commented Jul 17, 2025

r? @dswij

rustbot has assigned @dswij.
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

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jul 17, 2025
Copy link

Lintcheck changes for b2c4e6d

Lint Added Removed Changed
clippy::pattern_type_mismatch 0 67 1

This comment will be updated if you push new changes

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.

3 participants