[`pylint`] Clarify fix safety to include left-hand hashability (`PLR6201`) (#20518)

## Summary

Fixes #20510
This commit is contained in:
Dan Parizher 2025-10-01 13:58:24 -04:00 committed by GitHub
parent 71d711257a
commit caf48f4bfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -25,9 +25,11 @@ use crate::{AlwaysFixableViolation, Edit, Fix};
///
/// ## Fix safety
/// This rule's fix is marked as unsafe, as the use of a `set` literal will
/// error at runtime if the sequence contains unhashable elements (like lists
/// or dictionaries). While Ruff will attempt to infer the hashability of the
/// elements, it may not always be able to do so.
/// error at runtime if either the element being tested for membership (the
/// left-hand side) or any element of the sequence (the right-hand side)
/// is unhashable (like lists or dictionaries). While Ruff will attempt to
/// infer the hashability of both sides and skip the fix when it can determine
/// that either side is unhashable, it may not always be able to do so.
///
/// ## References
/// - [Whats New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)