Skip to content

Commit 2156100

Browse files
authored
[pyupgrade] Add fix safety section to docs (UP030) (#17443)
## Summary add fix safety section to format_literals, for #15584
1 parent 9c0772d commit 2156100

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

crates/ruff_linter/src/rules/pyupgrade/rules/format_literals.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ use crate::Locator;
3939
/// "{}, {}".format("Hello", "World") # "Hello, World"
4040
/// ```
4141
///
42+
/// This fix is marked as unsafe because:
43+
/// - Comments attached to arguments are not moved, which can cause comments to mismatch the actual arguments.
44+
/// - If arguments have side effects (e.g., print), reordering may change program behavior.
45+
///
4246
/// ## References
4347
/// - [Python documentation: Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax)
4448
/// - [Python documentation: `str.format`](https://docs.python.org/3/library/stdtypes.html#str.format)

0 commit comments

Comments
 (0)