---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP030 [*] Use implicit references for positional format fields
 --> UP030_0.py:3:1
  |
1 | # Invalid calls; errors expected.
2 |
3 | "{0}" "{1}" "{2}".format(1, 2, 3)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | "a {3} complicated {1} string with {0} {2}".format(
  |
help: Remove explicit positional indices
  |
2 |
  - "{0}" "{1}" "{2}".format(1, 2, 3)
3 + "{}" "{}" "{}".format(1, 2, 3)
4 |
  |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
 --> UP030_0.py:5:1
  |
3 |   "{0}" "{1}" "{2}".format(1, 2, 3)
4 |
5 | / "a {3} complicated {1} string with {0} {2}".format(
6 | |     "first", "second", "third", "fourth"
7 | | )
  | |_^
8 |
9 |   '{0}'.format(1)
  |
help: Remove explicit positional indices
  |
4 |
  - "a {3} complicated {1} string with {0} {2}".format(
  -     "first", "second", "third", "fourth"
5 + "a {} complicated {} string with {} {}".format(
6 +     "fourth", "second", "first", "third"
7 | )
  |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:9:1
   |
 7 | )
 8 |
 9 | '{0}'.format(1)
   | ^^^^^^^^^^^^^^^
10 |
11 | '{0:x}'.format(30)
   |
help: Remove explicit positional indices
   |
8  |
   - '{0}'.format(1)
9  + '{}'.format(1)
10 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:11:1
   |
 9 | '{0}'.format(1)
10 |
11 | '{0:x}'.format(30)
   | ^^^^^^^^^^^^^^^^^^
12 |
13 | x = '{0}'.format(1)
   |
help: Remove explicit positional indices
   |
10 |
   - '{0:x}'.format(30)
11 + '{:x}'.format(30)
12 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:13:5
   |
11 | '{0:x}'.format(30)
12 |
13 | x = '{0}'.format(1)
   |     ^^^^^^^^^^^^^^^
14 |
15 | '''{0}\n{1}\n'''.format(1, 2)
   |
help: Remove explicit positional indices
   |
12 |
   - x = '{0}'.format(1)
13 + x = '{}'.format(1)
14 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:15:1
   |
13 | x = '{0}'.format(1)
14 |
15 | '''{0}\n{1}\n'''.format(1, 2)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16 |
17 | x = "foo {0}" \
   |
help: Remove explicit positional indices
   |
14 |
   - '''{0}\n{1}\n'''.format(1, 2)
15 + '''{}\n{}\n'''.format(1, 2)
16 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:17:5
   |
15 |   '''{0}\n{1}\n'''.format(1, 2)
16 |
17 |   x = "foo {0}" \
   |  _____^
18 | |     "bar {1}".format(1, 2)
   | |__________________________^
19 |
20 |   ("{0}").format(1)
   |
help: Remove explicit positional indices
   |
16 |
   - x = "foo {0}" \
   -     "bar {1}".format(1, 2)
17 + x = "foo {}" \
18 +     "bar {}".format(1, 2)
19 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:20:1
   |
18 |     "bar {1}".format(1, 2)
19 |
20 | ("{0}").format(1)
   | ^^^^^^^^^^^^^^^^^
21 |
22 | "\N{snowman} {0}".format(1)
   |
help: Remove explicit positional indices
   |
19 |
   - ("{0}").format(1)
20 + ("{}").format(1)
21 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:22:1
   |
20 | ("{0}").format(1)
21 |
22 | "\N{snowman} {0}".format(1)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
23 |
24 | print(
   |
help: Remove explicit positional indices
   |
21 |
   - "\N{snowman} {0}".format(1)
22 + "\N{snowman} {}".format(1)
23 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:25:5
   |
24 |   print(
25 | /     'foo{0}'
26 | |     'bar{1}'.format(1, 2)
   | |_________________________^
27 |   )
   |
help: Remove explicit positional indices
   |
24 | print(
   -     'foo{0}'
   -     'bar{1}'.format(1, 2)
25 +     'foo{}'
26 +     'bar{}'.format(1, 2)
27 | )
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:30:5
   |
29 |   print(
30 | /     'foo{0}'  # ohai\n"
31 | |     'bar{1}'.format(1, 2)
   | |_________________________^
32 |   )
   |
help: Remove explicit positional indices
   |
29 | print(
   -     'foo{0}'  # ohai\n"
   -     'bar{1}'.format(1, 2)
30 +     'foo{}'  # ohai\n"
31 +     'bar{}'.format(1, 2)
32 | )
   |
note: This is an unsafe fix and may change runtime behavior

UP030 Use implicit references for positional format fields
  --> UP030_0.py:34:1
   |
32 | )
33 |
34 | '{' '0}'.format(1)
   | ^^^^^^^^^^^^^^^^^^
35 |
36 | args = list(range(10))
   |
help: Remove explicit positional indices

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:39:1
   |
37 | kwargs = {x: x for x in range(10)}
38 |
39 | "{0}".format(*args)
   | ^^^^^^^^^^^^^^^^^^^
40 |
41 | "{0}".format(**kwargs)
   |
help: Remove explicit positional indices
   |
38 |
   - "{0}".format(*args)
39 + "{}".format(*args)
40 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:41:1
   |
39 | "{0}".format(*args)
40 |
41 | "{0}".format(**kwargs)
   | ^^^^^^^^^^^^^^^^^^^^^^
42 |
43 | "{0}_{1}".format(*args)
   |
help: Remove explicit positional indices
   |
40 |
   - "{0}".format(**kwargs)
41 + "{}".format(**kwargs)
42 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:43:1
   |
41 | "{0}".format(**kwargs)
42 |
43 | "{0}_{1}".format(*args)
   | ^^^^^^^^^^^^^^^^^^^^^^^
44 |
45 | "{0}_{1}".format(1, *args)
   |
help: Remove explicit positional indices
   |
42 |
   - "{0}_{1}".format(*args)
43 + "{}_{}".format(*args)
44 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:45:1
   |
43 | "{0}_{1}".format(*args)
44 |
45 | "{0}_{1}".format(1, *args)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
46 |
47 | "{0}_{1}".format(1, 2, *args)
   |
help: Remove explicit positional indices
   |
44 |
   - "{0}_{1}".format(1, *args)
45 + "{}_{}".format(1, *args)
46 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:47:1
   |
45 | "{0}_{1}".format(1, *args)
46 |
47 | "{0}_{1}".format(1, 2, *args)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
48 |
49 | "{0}_{1}".format(*args, 1, 2)
   |
help: Remove explicit positional indices
   |
46 |
   - "{0}_{1}".format(1, 2, *args)
47 + "{}_{}".format(1, 2, *args)
48 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:49:1
   |
47 | "{0}_{1}".format(1, 2, *args)
48 |
49 | "{0}_{1}".format(*args, 1, 2)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
50 |
51 | "{0}_{1}_{2}".format(1, **kwargs)
   |
help: Remove explicit positional indices
   |
48 |
   - "{0}_{1}".format(*args, 1, 2)
49 + "{}_{}".format(*args, 1, 2)
50 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:51:1
   |
49 | "{0}_{1}".format(*args, 1, 2)
50 |
51 | "{0}_{1}_{2}".format(1, **kwargs)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52 |
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
   |
help: Remove explicit positional indices
   |
50 |
   - "{0}_{1}_{2}".format(1, **kwargs)
51 + "{}_{}_{}".format(1, **kwargs)
52 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:53:1
   |
51 | "{0}_{1}_{2}".format(1, **kwargs)
52 |
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54 |
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
   |
help: Remove explicit positional indices
   |
52 |
   - "{0}_{1}_{2}".format(1, 2, **kwargs)
53 + "{}_{}_{}".format(1, 2, **kwargs)
54 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:55:1
   |
53 | "{0}_{1}_{2}".format(1, 2, **kwargs)
54 |
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56 |
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
   |
help: Remove explicit positional indices
   |
54 |
   - "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
55 + "{}_{}_{}".format(1, 2, 3, **kwargs)
56 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:57:1
   |
55 | "{0}_{1}_{2}".format(1, 2, 3, **kwargs)
56 |
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58 |
59 | "{1}_{0}".format(1, 2, *args)
   |
help: Remove explicit positional indices
   |
56 |
   - "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
57 + "{}_{}_{}".format(1, 2, 3, *args, **kwargs)
58 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:59:1
   |
57 | "{0}_{1}_{2}".format(1, 2, 3, *args, **kwargs)
58 |
59 | "{1}_{0}".format(1, 2, *args)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60 |
61 | "{1}_{0}".format(1, 2)
   |
help: Remove explicit positional indices
   |
58 |
   - "{1}_{0}".format(1, 2, *args)
59 + "{}_{}".format(2, 1, )
60 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:61:1
   |
59 | "{1}_{0}".format(1, 2, *args)
60 |
61 | "{1}_{0}".format(1, 2)
   | ^^^^^^^^^^^^^^^^^^^^^^
62 |
63 | r"\d{{1,2}} {0}".format(42)
   |
help: Remove explicit positional indices
   |
60 |
   - "{1}_{0}".format(1, 2)
61 + "{}_{}".format(2, 1)
62 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:63:1
   |
61 | "{1}_{0}".format(1, 2)
62 |
63 | r"\d{{1,2}} {0}".format(42)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
64 |
65 | "{{{0}}}".format(123)
   |
help: Remove explicit positional indices
   |
62 |
   - r"\d{{1,2}} {0}".format(42)
63 + r"\d{{1,2}} {}".format(42)
64 |
   |
note: This is an unsafe fix and may change runtime behavior

UP030 [*] Use implicit references for positional format fields
  --> UP030_0.py:65:1
   |
63 | r"\d{{1,2}} {0}".format(42)
64 |
65 | "{{{0}}}".format(123)
   | ^^^^^^^^^^^^^^^^^^^^^
   |
help: Remove explicit positional indices
   |
64 |
   - "{{{0}}}".format(123)
65 + "{{{}}}".format(123)
   |
note: This is an unsafe fix and may change runtime behavior
