Skip to content

Commit 05a2f52

Browse files
Document literal-membership fix safety conditions (#9677)
## Summary This seems safe to me. See #8482 (comment). ## Test Plan `cargo test`
1 parent a6f7100 commit 05a2f52

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ use crate::checkers::ast::Checker;
2121
/// ```python
2222
/// 1 in {1, 2, 3}
2323
/// ```
24+
///
25+
/// ## Fix safety
26+
/// This rule's fix is marked as unsafe, as the use of a `set` literal will
27+
/// error at runtime if the sequence contains unhashable elements (like lists
28+
/// or dictionaries).
29+
///
2430
/// ## References
2531
/// - [What’s New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)
2632
#[violation]

0 commit comments

Comments
 (0)