Skip to content

Conversation

@estebank
Copy link
Contributor

@estebank estebank commented Dec 26, 2025

In the codebase we sometimes use matches! for values that can actually just be compared. Replace them with ==.

Subset of #149933.

@rustbot
Copy link
Collaborator

rustbot commented Dec 26, 2025

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 26, 2025
@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 26, 2025

r? @fee1-dead

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

@rust-log-analyzer

This comment has been minimized.

In the codebase we sometimes use `matches!` for values that can actually just be compared. Replace them with `==`.
@estebank estebank force-pushed the matches-could-be-equals branch from f77875a to 9f566f2 Compare December 26, 2025 20:28
Copy link
Member

@Kivooeo Kivooeo left a comment

Choose a reason for hiding this comment

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

Looks good to me, but honestly it's so unusual to read pattern matching with a ==, when I find matches! more familiar

If this is what we are in favour to, because as far as I understand previous discussion ended on that we want to use == instead of matches!, then yeah, let's do it, I guess i will get used to it pretty fast

View changes since this review

@oli-obk
Copy link
Contributor

oli-obk commented Dec 27, 2025

I personally prefer using if let. matches! feels like a hack due to no chaining support in earlier Rust. See also my comment in #149933 (comment)

@Kivooeo
Copy link
Member

Kivooeo commented Dec 27, 2025

r? me

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 27, 2025

📌 Commit 9f566f2 has been approved by Kivooeo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 27, 2025
bors added a commit that referenced this pull request Dec 27, 2025
…uwer

Rollup of 2 pull requests

Successful merges:

 - #150393 (Document relative and absolute paths handling in `--remap-path-prefix`)
 - #150405 (Don't use `matches!` when `==` suffices)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d63068b into rust-lang:main Dec 27, 2025
11 checks passed
rust-timer added a commit that referenced this pull request Dec 27, 2025
Rollup merge of #150405 - estebank:matches-could-be-equals, r=Kivooeo

Don't use `matches!` when `==` suffices

In the codebase we sometimes use `matches!` for values that can actually just be compared. Replace them with `==`.

Subset of #149933.
@rustbot rustbot added this to the 1.94.0 milestone Dec 27, 2025
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 28, 2025
…uwer

Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#150393 (Document relative and absolute paths handling in `--remap-path-prefix`)
 - rust-lang/rust#150405 (Don't use `matches!` when `==` suffices)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants