Skip to content

Commit caf48f4

Browse files
authored
[pylint] Clarify fix safety to include left-hand hashability (PLR6201) (#20518)
## Summary Fixes #20510
1 parent 71d7112 commit caf48f4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/ruff_linter/src/rules/pylint/rules/literal_membership.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ use crate::{AlwaysFixableViolation, Edit, Fix};
2525
///
2626
/// ## Fix safety
2727
/// This rule's fix is marked as unsafe, as the use of a `set` literal will
28-
/// error at runtime if the sequence contains unhashable elements (like lists
29-
/// or dictionaries). While Ruff will attempt to infer the hashability of the
30-
/// elements, it may not always be able to do so.
28+
/// error at runtime if either the element being tested for membership (the
29+
/// left-hand side) or any element of the sequence (the right-hand side)
30+
/// is unhashable (like lists or dictionaries). While Ruff will attempt to
31+
/// infer the hashability of both sides and skip the fix when it can determine
32+
/// that either side is unhashable, it may not always be able to do so.
3133
///
3234
/// ## References
3335
/// - [What’s New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)

0 commit comments

Comments
 (0)