Don't enforce object-without-hash-method in stubs (#15310)

## Summary

Closes https://github.com/astral-sh/ruff/issues/15292.
This commit is contained in:
Charlie Marsh 2025-01-06 21:51:06 -05:00 committed by GitHub
parent 5e9259c96c
commit 75a24bbc67
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,6 +111,9 @@ impl Violation for EqWithoutHash {
/// W1641 /// W1641
pub(crate) fn object_without_hash_method(checker: &mut Checker, class: &StmtClassDef) { pub(crate) fn object_without_hash_method(checker: &mut Checker, class: &StmtClassDef) {
if checker.source_type.is_stub() {
return;
}
let eq_hash = EqHash::from_class(class); let eq_hash = EqHash::from_class(class);
if matches!( if matches!(
eq_hash, eq_hash,