---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
---
F522 [*] `.format` call has unused named argument(s): bar
 --> F522.py:1:1
  |
1 | "{}".format(1, bar=2)  # F522
  | ^^^^^^^^^^^^^^^^^^^^^
2 | "{bar}{}".format(1, bar=2, spam=3)  # F522
3 | "{bar:{spam}}".format(bar=2, spam=3)  # No issues
  |
help: Remove extra named arguments: bar
  |
  - "{}".format(1, bar=2)  # F522
1 + "{}".format(1, )  # F522
2 | "{bar}{}".format(1, bar=2, spam=3)  # F522
  |

F522 [*] `.format` call has unused named argument(s): spam
 --> F522.py:2:1
  |
1 | "{}".format(1, bar=2)  # F522
2 | "{bar}{}".format(1, bar=2, spam=3)  # F522
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | "{bar:{spam}}".format(bar=2, spam=3)  # No issues
4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5)  # F522
  |
help: Remove extra named arguments: spam
  |
1 | "{}".format(1, bar=2)  # F522
  - "{bar}{}".format(1, bar=2, spam=3)  # F522
2 + "{bar}{}".format(1, bar=2, )  # F522
3 | "{bar:{spam}}".format(bar=2, spam=3)  # No issues
  |

F522 [*] `.format` call has unused named argument(s): eggs, ham
 --> F522.py:4:1
  |
2 | "{bar}{}".format(1, bar=2, spam=3)  # F522
3 | "{bar:{spam}}".format(bar=2, spam=3)  # No issues
4 | "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5)  # F522
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 | (''
6 |  .format(x=2))  # F522
  |
help: Remove extra named arguments: eggs, ham
  |
3 | "{bar:{spam}}".format(bar=2, spam=3)  # No issues
  - "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5)  # F522
4 + "{bar:{spam}}".format(bar=2, spam=3, )  # F522
5 | (''
  |

F522 [*] `.format` call has unused named argument(s): x
 --> F522.py:5:2
  |
3 |   "{bar:{spam}}".format(bar=2, spam=3)  # No issues
4 |   "{bar:{spam}}".format(bar=2, spam=3, eggs=4, ham=5)  # F522
5 |   (''
  |  __^
6 | |  .format(x=2))  # F522
  | |_____________^
7 |
8 |   # https://github.com/astral-sh/ruff/issues/18806
  |
help: Remove extra named arguments: x
  |
5 | (''
  -  .format(x=2))  # F522
6 +  .format())  # F522
7 |
  |

F522 [*] `.format` call has unused named argument(s): greeting
  --> F522.py:10:1
   |
 8 | # https://github.com/astral-sh/ruff/issues/18806
 9 | # The fix here is unsafe because the unused argument has side effect
10 | "Hello, {name}".format(greeting=print(1), name="World")
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11 |
12 | # The fix here is safe because the unused argument has no side effect,
   |
help: Remove extra named arguments: greeting
   |
9  | # The fix here is unsafe because the unused argument has side effect
   - "Hello, {name}".format(greeting=print(1), name="World")
10 + "Hello, {name}".format(name="World")
11 |
   |
note: This is an unsafe fix and may change runtime behavior

F522 [*] `.format` call has unused named argument(s): greeting
  --> F522.py:14:1
   |
12 | # The fix here is safe because the unused argument has no side effect,
13 | # even though the used argument has a side effect
14 | "Hello, {name}".format(greeting="Pikachu", name=print(1))
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Remove extra named arguments: greeting
   |
13 | # even though the used argument has a side effect
   - "Hello, {name}".format(greeting="Pikachu", name=print(1))
14 + "Hello, {name}".format(name=print(1))
   |
