---
source: crates/ruff_linter/src/rules/pyflakes/mod.rs
---
F841 [*] Local variable `x` is assigned to but never used
 --> F841_1.py:6:5
  |
5 | def f():
6 |     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
  |     ^
  |
help: Remove assignment to unused variable `x`
  |
5 | def f():
  -     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
6 +     _x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
7 |
  |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `y` is assigned to but never used
 --> F841_1.py:6:8
  |
5 | def f():
6 |     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
  |        ^
  |
help: Remove assignment to unused variable `y`
  |
5 | def f():
  -     x, y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
6 +     x, _y = 1, 2  # this triggers F841 as it's just a simple assignment where unpacking isn't needed
7 |
  |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `coords` is assigned to but never used
  --> F841_1.py:16:14
   |
15 | def f():
16 |     (x, y) = coords = 1, 2
   |              ^^^^^^
   |
help: Remove assignment to unused variable `coords`
   |
15 | def f():
   -     (x, y) = coords = 1, 2
16 +     (x, y) = 1, 2
17 |
   |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `coords` is assigned to but never used
  --> F841_1.py:20:5
   |
19 | def f():
20 |     coords = (x, y) = 1, 2
   |     ^^^^^^
   |
help: Remove assignment to unused variable `coords`
   |
19 | def f():
   -     coords = (x, y) = 1, 2
20 +     (x, y) = 1, 2
21 |
   |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `a` is assigned to but never used
  --> F841_1.py:24:6
   |
23 | def f():
24 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |      ^
   |
help: Remove assignment to unused variable `a`
   |
23 | def f():
   -     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
24 +     (_a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `b` is assigned to but never used
  --> F841_1.py:24:9
   |
23 | def f():
24 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |         ^
   |
help: Remove assignment to unused variable `b`
   |
23 | def f():
   -     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
24 +     (a, _b) = (x, y) = 1, 2  # this triggers F841 on everything
   |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `x` is assigned to but never used
  --> F841_1.py:24:15
   |
23 | def f():
24 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |               ^
   |
help: Remove assignment to unused variable `x`
   |
23 | def f():
   -     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
24 +     (a, b) = (_x, y) = 1, 2  # this triggers F841 on everything
   |
note: This is an unsafe fix and may change runtime behavior

F841 [*] Local variable `y` is assigned to but never used
  --> F841_1.py:24:18
   |
23 | def f():
24 |     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
   |                  ^
   |
help: Remove assignment to unused variable `y`
   |
23 | def f():
   -     (a, b) = (x, y) = 1, 2  # this triggers F841 on everything
24 +     (a, b) = (x, _y) = 1, 2  # this triggers F841 on everything
   |
note: This is an unsafe fix and may change runtime behavior
