[pylint] add fix safety section (PLE4703) (#17824)

This PR adds a fix safety section in comment for rule PLE4703.

parent: #15584 
impl was introduced at #970 (couldn't find newer PRs sorry!)
This commit is contained in:
Yunchi Pang 2025-05-12 13:27:54 -07:00 committed by GitHub
parent b2d9f59937
commit d545b5bfd2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -38,6 +38,11 @@ use crate::checkers::ast::Checker;
/// nums.add(num + 5) /// nums.add(num + 5)
/// ``` /// ```
/// ///
/// ## Fix safety
/// This fix is always unsafe because it changes the programs behavior. Replacing the
/// original set with a copy during iteration allows code that would previously raise a
/// `RuntimeError` to run without error.
///
/// ## References /// ## References
/// - [Python documentation: `set`](https://docs.python.org/3/library/stdtypes.html#set) /// - [Python documentation: `set`](https://docs.python.org/3/library/stdtypes.html#set)
#[derive(ViolationMetadata)] #[derive(ViolationMetadata)]