---
source: crates/ruff_linter/src/rules/refurb/mod.rs
snapshot_kind: text
---
FURB148.py:14:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
13 | # Errors
14 | for index, _ in enumerate(books):
   |                 ^^^^^^^^^ FURB148
15 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
11 11 | books_tuple = ("Dune", "Foundation", "Neuromancer")
12 12 | 
13 13 | # Errors
14    |-for index, _ in enumerate(books):
   14 |+for index in range(len(books)):
15 15 |     print(index)
16 16 | 
17 17 | for index, _ in enumerate(books, start=0):

FURB148.py:17:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
15 |     print(index)
16 | 
17 | for index, _ in enumerate(books, start=0):
   |                 ^^^^^^^^^ FURB148
18 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
14 14 | for index, _ in enumerate(books):
15 15 |     print(index)
16 16 | 
17    |-for index, _ in enumerate(books, start=0):
   17 |+for index in range(len(books)):
18 18 |     print(index)
19 19 | 
20 20 | for index, _ in enumerate(books, 0):

FURB148.py:20:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
18 |     print(index)
19 | 
20 | for index, _ in enumerate(books, 0):
   |                 ^^^^^^^^^ FURB148
21 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
17 17 | for index, _ in enumerate(books, start=0):
18 18 |     print(index)
19 19 | 
20    |-for index, _ in enumerate(books, 0):
   20 |+for index in range(len(books)):
21 21 |     print(index)
22 22 | 
23 23 | for index, _ in enumerate(books, start=1):

FURB148.py:23:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead
   |
21 |     print(index)
22 | 
23 | for index, _ in enumerate(books, start=1):
   |                 ^^^^^^^^^ FURB148
24 |     print(index)
   |
   = help: Replace with `range(len(...))`

FURB148.py:26:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead
   |
24 |     print(index)
25 | 
26 | for index, _ in enumerate(books, 1):
   |                 ^^^^^^^^^ FURB148
27 |     print(index)
   |
   = help: Replace with `range(len(...))`

FURB148.py:29:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead
   |
27 |     print(index)
28 | 
29 | for index, _ in enumerate(books, start=x):
   |                 ^^^^^^^^^ FURB148
30 |     print(book)
   |
   = help: Replace with `range(len(...))`

FURB148.py:32:17: FURB148 `enumerate` value is unused, use `for x in range(len(y))` instead
   |
30 |     print(book)
31 | 
32 | for index, _ in enumerate(books, x):
   |                 ^^^^^^^^^ FURB148
33 |     print(book)
   |
   = help: Replace with `range(len(...))`

FURB148.py:35:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
33 |     print(book)
34 | 
35 | for _, book in enumerate(books):
   |                ^^^^^^^^^ FURB148
36 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
32 32 | for index, _ in enumerate(books, x):
33 33 |     print(book)
34 34 | 
35    |-for _, book in enumerate(books):
   35 |+for book in books:
36 36 |     print(book)
37 37 | 
38 38 | for _, book in enumerate(books, start=0):

FURB148.py:38:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
36 |     print(book)
37 | 
38 | for _, book in enumerate(books, start=0):
   |                ^^^^^^^^^ FURB148
39 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
35 35 | for _, book in enumerate(books):
36 36 |     print(book)
37 37 | 
38    |-for _, book in enumerate(books, start=0):
   38 |+for book in books:
39 39 |     print(book)
40 40 | 
41 41 | for _, book in enumerate(books, 0):

FURB148.py:41:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
39 |     print(book)
40 | 
41 | for _, book in enumerate(books, 0):
   |                ^^^^^^^^^ FURB148
42 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
38 38 | for _, book in enumerate(books, start=0):
39 39 |     print(book)
40 40 | 
41    |-for _, book in enumerate(books, 0):
   41 |+for book in books:
42 42 |     print(book)
43 43 | 
44 44 | for _, book in enumerate(books, start=1):

FURB148.py:44:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
42 |     print(book)
43 | 
44 | for _, book in enumerate(books, start=1):
   |                ^^^^^^^^^ FURB148
45 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
41 41 | for _, book in enumerate(books, 0):
42 42 |     print(book)
43 43 | 
44    |-for _, book in enumerate(books, start=1):
   44 |+for book in books:
45 45 |     print(book)
46 46 | 
47 47 | for _, book in enumerate(books, 1):

FURB148.py:47:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
45 |     print(book)
46 | 
47 | for _, book in enumerate(books, 1):
   |                ^^^^^^^^^ FURB148
48 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
44 44 | for _, book in enumerate(books, start=1):
45 45 |     print(book)
46 46 | 
47    |-for _, book in enumerate(books, 1):
   47 |+for book in books:
48 48 |     print(book)
49 49 | 
50 50 | for _, book in enumerate(books, start=x):

FURB148.py:50:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
48 |     print(book)
49 | 
50 | for _, book in enumerate(books, start=x):
   |                ^^^^^^^^^ FURB148
51 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
47 47 | for _, book in enumerate(books, 1):
48 48 |     print(book)
49 49 | 
50    |-for _, book in enumerate(books, start=x):
   50 |+for book in books:
51 51 |     print(book)
52 52 | 
53 53 | for _, book in enumerate(books, x):

FURB148.py:53:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
51 |     print(book)
52 | 
53 | for _, book in enumerate(books, x):
   |                ^^^^^^^^^ FURB148
54 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
50 50 | for _, book in enumerate(books, start=x):
51 51 |     print(book)
52 52 | 
53    |-for _, book in enumerate(books, x):
   53 |+for book in books:
54 54 |     print(book)
55 55 | 
56 56 | for index, (_, _) in enumerate(books):

FURB148.py:56:22: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
54 |     print(book)
55 | 
56 | for index, (_, _) in enumerate(books):
   |                      ^^^^^^^^^ FURB148
57 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
53 53 | for _, book in enumerate(books, x):
54 54 |     print(book)
55 55 | 
56    |-for index, (_, _) in enumerate(books):
   56 |+for index in range(len(books)):
57 57 |     print(index)
58 58 | 
59 59 | for (_, _), book in enumerate(books):

FURB148.py:59:21: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
57 |     print(index)
58 | 
59 | for (_, _), book in enumerate(books):
   |                     ^^^^^^^^^ FURB148
60 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
56 56 | for index, (_, _) in enumerate(books):
57 57 |     print(index)
58 58 | 
59    |-for (_, _), book in enumerate(books):
   59 |+for book in books:
60 60 |     print(book)
61 61 | 
62 62 | for(index, _)in enumerate(books):

FURB148.py:62:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
60 |     print(book)
61 | 
62 | for(index, _)in enumerate(books):
   |                 ^^^^^^^^^ FURB148
63 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
59 59 | for (_, _), book in enumerate(books):
60 60 |     print(book)
61 61 | 
62    |-for(index, _)in enumerate(books):
   62 |+for index in range(len(books)):
63 63 |     print(index)
64 64 | 
65 65 | for(index), _ in enumerate(books):

FURB148.py:65:18: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
63 |     print(index)
64 | 
65 | for(index), _ in enumerate(books):
   |                  ^^^^^^^^^ FURB148
66 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
62 62 | for(index, _)in enumerate(books):
63 63 |     print(index)
64 64 | 
65    |-for(index), _ in enumerate(books):
   65 |+for index in range(len(books)):
66 66 |     print(index)
67 67 | 
68 68 | for index, _ in enumerate(books_and_authors):

FURB148.py:68:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
66 |     print(index)
67 | 
68 | for index, _ in enumerate(books_and_authors):
   |                 ^^^^^^^^^ FURB148
69 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
65 65 | for(index), _ in enumerate(books):
66 66 |     print(index)
67 67 | 
68    |-for index, _ in enumerate(books_and_authors):
   68 |+for index in range(len(books_and_authors)):
69 69 |     print(index)
70 70 | 
71 71 | for _, book in enumerate(books_and_authors):

FURB148.py:71:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
69 |     print(index)
70 | 
71 | for _, book in enumerate(books_and_authors):
   |                ^^^^^^^^^ FURB148
72 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
68 68 | for index, _ in enumerate(books_and_authors):
69 69 |     print(index)
70 70 | 
71    |-for _, book in enumerate(books_and_authors):
   71 |+for book in books_and_authors:
72 72 |     print(book)
73 73 | 
74 74 | for index, _ in enumerate(books_set):

FURB148.py:74:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
72 |     print(book)
73 | 
74 | for index, _ in enumerate(books_set):
   |                 ^^^^^^^^^ FURB148
75 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
71 71 | for _, book in enumerate(books_and_authors):
72 72 |     print(book)
73 73 | 
74    |-for index, _ in enumerate(books_set):
   74 |+for index in range(len(books_set)):
75 75 |     print(index)
76 76 | 
77 77 | for _, book in enumerate(books_set):

FURB148.py:77:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
75 |     print(index)
76 | 
77 | for _, book in enumerate(books_set):
   |                ^^^^^^^^^ FURB148
78 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
74 74 | for index, _ in enumerate(books_set):
75 75 |     print(index)
76 76 | 
77    |-for _, book in enumerate(books_set):
   77 |+for book in books_set:
78 78 |     print(book)
79 79 | 
80 80 | for index, _ in enumerate(books_tuple):

FURB148.py:80:17: FURB148 [*] `enumerate` value is unused, use `for x in range(len(y))` instead
   |
78 |     print(book)
79 | 
80 | for index, _ in enumerate(books_tuple):
   |                 ^^^^^^^^^ FURB148
81 |     print(index)
   |
   = help: Replace with `range(len(...))`

ℹ Unsafe fix
77 77 | for _, book in enumerate(books_set):
78 78 |     print(book)
79 79 | 
80    |-for index, _ in enumerate(books_tuple):
   80 |+for index in range(len(books_tuple)):
81 81 |     print(index)
82 82 | 
83 83 | for _, book in enumerate(books_tuple):

FURB148.py:83:16: FURB148 [*] `enumerate` index is unused, use `for x in y` instead
   |
81 |     print(index)
82 | 
83 | for _, book in enumerate(books_tuple):
   |                ^^^^^^^^^ FURB148
84 |     print(book)
   |
   = help: Remove `enumerate`

ℹ Unsafe fix
80 80 | for index, _ in enumerate(books_tuple):
81 81 |     print(index)
82 82 | 
83    |-for _, book in enumerate(books_tuple):
   83 |+for book in books_tuple:
84 84 |     print(book)
85 85 | 
86 86 | # OK
