Skip to content

Commit

Permalink
Document literal-membership fix safety conditions (#9677)
Browse files Browse the repository at this point in the history
## Summary

This seems safe to me. See
#8482 (comment).

## Test Plan

`cargo test`
  • Loading branch information
charliermarsh authored Jan 29, 2024
1 parent a6f7100 commit 05a2f52
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ use crate::checkers::ast::Checker;
/// ```python
/// 1 in {1, 2, 3}
/// ```
///
/// ## 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).
///
/// ## References
/// - [What’s New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)
#[violation]
Expand Down

0 comments on commit 05a2f52

Please sign in to comment.