-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Make SpanlessEq
more consistent
#10267
Comments
Note that SpanlessEq is used in Also the consistency between Hash and Eq goes only one way: Two equal values must hash to the same hash, but two unequal values may hash to the same hash. So I'd suggest seeking further consistency here is misguided. Perhaps we should add a comment stating that fact. |
I don't suggest changing the default. We should remove the wildcard completely. My main motivation for this is, that then, when new I'm fine with as a first step to do a NFC and replace the wildcard with all missing expr kinds and keep uh, removing the wildcard completely might not even be possible, because we have to deal with different |
Probably worth having the final pattern be |
I'd be happy to pick this issue as a way to familiarize myself with clippy's code. But
Does this mean that this issue is actionable or not? |
What should be done is to check if every To get rid of the wildcard, I think we can try Jarchos suggestion. |
I'll take a look later today. |
- Get rid of the wildcard `_ => false` in `SpanlessEq::eq_expr`. - Make sure that `SpanlessEq::eq_expr` branches remain in alphabetical order.
- Get rid of the wildcard `_ => false` in `SpanlessEq::eq_expr`. - Make sure that `SpanlessEq::eq_expr` branches remain in alphabetical order.
@rustbot claim |
Make SpanlessEq more consistent 1) Remove wildcard as requested in #10267. 2) Implement `hir_utils::eq_expr` for `ExprKind::Closure`, `ExprKind::ConstBlock`, `ExprKind::InlineAsm` and `ExprKind::Yield`. 3) Reorder branches of `hir_utils::eq_expr` to be in alphabetical order. --- changelog: none
I believe that this issue can now be closed since this PR was merged #11736. |
Thanks! Yes this is all done now. |
Description
The
SpanlessEq::eq_expr
implementation has a wildcard match arm that just returnsfalse
.rust-clippy/clippy_utils/src/hir_utils.rs
Line 305 in d227f18
This is inconsistent with
SpanlessHash
, which implements hashing for each expressions type.rust-clippy/clippy_utils/src/hir_utils.rs
Lines 785 to 789 in d227f18
PartialEq
andHash
implementations have to be consistent. The same should apply toSpanlessEq
andSpanlessHash
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: