mirror of https://github.com/astral-sh/ruff
[`pyupgrade`] Add fix safety section to docs (`UP029`) (#17490)
## Summary Add `fix safety` section to `UP029: unnecessary_builtin_import.rs`, for #15584
This commit is contained in:
parent
8a6db4f257
commit
c2d7c673ca
|
|
@ -27,6 +27,21 @@ use crate::{AlwaysFixableViolation, Fix};
|
|||
/// str(1)
|
||||
/// ```
|
||||
///
|
||||
/// ## Fix safety
|
||||
/// This fix is marked as unsafe because removing the import
|
||||
/// may change program behavior. For example, in the following
|
||||
/// situation:
|
||||
///
|
||||
/// ```python
|
||||
/// def str(x):
|
||||
/// return x
|
||||
///
|
||||
///
|
||||
/// from builtins import str
|
||||
///
|
||||
/// str(1) # `"1"` with the import, `1` without
|
||||
/// ```
|
||||
///
|
||||
/// ## References
|
||||
/// - [Python documentation: The Python Standard Library](https://docs.python.org/3/library/index.html)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue