diff --git a/crates/ruff_linter/src/rules/pyupgrade/rules/format_literals.rs b/crates/ruff_linter/src/rules/pyupgrade/rules/format_literals.rs index b14f9ad181ceb5..bfa426788997ba 100644 --- a/crates/ruff_linter/src/rules/pyupgrade/rules/format_literals.rs +++ b/crates/ruff_linter/src/rules/pyupgrade/rules/format_literals.rs @@ -39,6 +39,10 @@ use crate::Locator; /// "{}, {}".format("Hello", "World") # "Hello, World" /// ``` /// +/// This fix is marked as unsafe because: +/// - Comments attached to arguments are not moved, which can cause comments to mismatch the actual arguments. +/// - If arguments have side effects (e.g., print), reordering may change program behavior. +/// /// ## References /// - [Python documentation: Format String Syntax](https://docs.python.org/3/library/string.html#format-string-syntax) /// - [Python documentation: `str.format`](https://docs.python.org/3/library/stdtypes.html#str.format)