---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:16:1
   |
15 | # Errors
16 | zip(input, input[1:])
   | ^^^
17 | zip(input, input[1::1])
18 | zip(input[:-1], input[1:])
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
16 | # Errors
   - zip(input, input[1:])
17 + itertools.pairwise(input)
18 | zip(input, input[1::1])
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:17:1
   |
15 | # Errors
16 | zip(input, input[1:])
17 | zip(input, input[1::1])
   | ^^^
18 | zip(input[:-1], input[1:])
19 | zip(input[1:], input[2:])
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
17 | zip(input, input[1:])
   - zip(input, input[1::1])
18 + itertools.pairwise(input)
19 | zip(input[:-1], input[1:])
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:18:1
   |
16 | zip(input, input[1:])
17 | zip(input, input[1::1])
18 | zip(input[:-1], input[1:])
   | ^^^
19 | zip(input[1:], input[2:])
20 | zip(input[1:-1], input[2:])
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
18 | zip(input, input[1::1])
   - zip(input[:-1], input[1:])
19 + itertools.pairwise(input)
20 | zip(input[1:], input[2:])
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:19:1
   |
17 | zip(input, input[1::1])
18 | zip(input[:-1], input[1:])
19 | zip(input[1:], input[2:])
   | ^^^
20 | zip(input[1:-1], input[2:])
21 | list(zip(input, input[1:]))
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
19 | zip(input[:-1], input[1:])
   - zip(input[1:], input[2:])
20 + itertools.pairwise(input)
21 | zip(input[1:-1], input[2:])
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:20:1
   |
18 | zip(input[:-1], input[1:])
19 | zip(input[1:], input[2:])
20 | zip(input[1:-1], input[2:])
   | ^^^
21 | list(zip(input, input[1:]))
22 | list(zip(input[:-1], input[1:]))
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
20 | zip(input[1:], input[2:])
   - zip(input[1:-1], input[2:])
21 + itertools.pairwise(input)
22 | list(zip(input, input[1:]))
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:21:6
   |
19 | zip(input[1:], input[2:])
20 | zip(input[1:-1], input[2:])
21 | list(zip(input, input[1:]))
   |      ^^^
22 | list(zip(input[:-1], input[1:]))
23 | zip(foo[:-1], foo[1:], strict=True)
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
21 | zip(input[1:-1], input[2:])
   - list(zip(input, input[1:]))
22 + list(itertools.pairwise(input))
23 | list(zip(input[:-1], input[1:]))
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:22:6
   |
20 | zip(input[1:-1], input[2:])
21 | list(zip(input, input[1:]))
22 | list(zip(input[:-1], input[1:]))
   |      ^^^
23 | zip(foo[:-1], foo[1:], strict=True)
24 | zip(foo[:-1], foo[1:], strict=False)
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
22 | list(zip(input, input[1:]))
   - list(zip(input[:-1], input[1:]))
23 + list(itertools.pairwise(input))
24 | zip(foo[:-1], foo[1:], strict=True)
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:23:1
   |
21 | list(zip(input, input[1:]))
22 | list(zip(input[:-1], input[1:]))
23 | zip(foo[:-1], foo[1:], strict=True)
   | ^^^
24 | zip(foo[:-1], foo[1:], strict=False)
25 | zip(foo[:-1], foo[1:], strict=bool(foo))
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
23 | list(zip(input[:-1], input[1:]))
   - zip(foo[:-1], foo[1:], strict=True)
24 + itertools.pairwise(foo)
25 | zip(foo[:-1], foo[1:], strict=False)
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:24:1
   |
22 | list(zip(input[:-1], input[1:]))
23 | zip(foo[:-1], foo[1:], strict=True)
24 | zip(foo[:-1], foo[1:], strict=False)
   | ^^^
25 | zip(foo[:-1], foo[1:], strict=bool(foo))
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
24 | zip(foo[:-1], foo[1:], strict=True)
   - zip(foo[:-1], foo[1:], strict=False)
25 + itertools.pairwise(foo)
26 | zip(foo[:-1], foo[1:], strict=bool(foo))
   |
note: This is an unsafe fix and may change runtime behavior

RUF007 [*] Prefer `itertools.pairwise()` over `zip()` when iterating over successive pairs
  --> RUF007.py:25:1
   |
23 | zip(foo[:-1], foo[1:], strict=True)
24 | zip(foo[:-1], foo[1:], strict=False)
25 | zip(foo[:-1], foo[1:], strict=bool(foo))
   | ^^^
   |
help: Replace `zip()` with `itertools.pairwise()`
   |
1  + import itertools
2  | input = [1, 2, 3]
--------------------------------------------------------------------------------
25 | zip(foo[:-1], foo[1:], strict=False)
   - zip(foo[:-1], foo[1:], strict=bool(foo))
26 + itertools.pairwise(foo)
   |
note: This is an unsafe fix and may change runtime behavior
