mirror of https://github.com/astral-sh/ruff
Document `literal-membership` fix safety conditions (#9677)
## Summary This seems safe to me. See https://github.com/astral-sh/ruff/issues/8482#issuecomment-1859299411. ## Test Plan `cargo test`
This commit is contained in:
parent
a6f7100b55
commit
05a2f52206
|
|
@ -21,6 +21,12 @@ use crate::checkers::ast::Checker;
|
||||||
/// ```python
|
/// ```python
|
||||||
/// 1 in {1, 2, 3}
|
/// 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
|
/// ## References
|
||||||
/// - [What’s New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)
|
/// - [What’s New In Python 3.2](https://docs.python.org/3/whatsnew/3.2.html#optimizations)
|
||||||
#[violation]
|
#[violation]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue