---
source: crates/ruff/src/rules/pyupgrade/mod.rs
---
UP030_0.py:3:1: UP030 [*] Use implicit references for positional format fields
  |
3 | # Invalid calls; errors expected.
4 | 
5 | "{0}" "{1}" "{2}".format(1, 2, 3)
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
6 | 
7 | "a {3} complicated {1} string with {0} {2}".format(
  |
  = help: Remove explicit positional indices

ℹ Suggested fix
1 1 | # Invalid calls; errors expected.
2 2 | 
3   |-"{0}" "{1}" "{2}".format(1, 2, 3)
  3 |+"{}" "{}" "{}".format(1, 2, 3)
4 4 | 
5 5 | "a {3} complicated {1} string with {0} {2}".format(
6 6 |     "first", "second", "third", "fourth"

UP030_0.py:5:1: UP030 [*] Use implicit references for positional format fields
   |
 5 |   "{0}" "{1}" "{2}".format(1, 2, 3)
 6 |   
 7 | / "a {3} complicated {1} string with {0} {2}".format(
 8 | |     "first", "second", "third", "fourth"
 9 | | )
   | |_^ UP030
10 |   
11 |   '{0}'.format(1)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
2 2 | 
3 3 | "{0}" "{1}" "{2}".format(1, 2, 3)
4 4 | 
5   |-"a {3} complicated {1} string with {0} {2}".format(
6   |-    "first", "second", "third", "fourth"
  5 |+"a {} complicated {} string with {} {}".format(
  6 |+    "fourth", "second", "first", "third"
7 7 | )
8 8 | 
9 9 | '{0}'.format(1)

UP030_0.py:9:1: UP030 [*] Use implicit references for positional format fields
   |
 9 | )
10 | 
11 | '{0}'.format(1)
   | ^^^^^^^^^^^^^^^ UP030
12 | 
13 | '{0:x}'.format(30)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
6  6  |     "first", "second", "third", "fourth"
7  7  | )
8  8  | 
9     |-'{0}'.format(1)
   9  |+'{}'.format(1)
10 10 | 
11 11 | '{0:x}'.format(30)
12 12 | 

UP030_0.py:11:1: UP030 [*] Use implicit references for positional format fields
   |
11 | '{0}'.format(1)
12 | 
13 | '{0:x}'.format(30)
   | ^^^^^^^^^^^^^^^^^^ UP030
14 | 
15 | x = '{0}'.format(1)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
8  8  | 
9  9  | '{0}'.format(1)
10 10 | 
11    |-'{0:x}'.format(30)
   11 |+'{:x}'.format(30)
12 12 | 
13 13 | x = '{0}'.format(1)
14 14 | 

UP030_0.py:13:5: UP030 [*] Use implicit references for positional format fields
   |
13 | '{0:x}'.format(30)
14 | 
15 | x = '{0}'.format(1)
   |     ^^^^^^^^^^^^^^^ UP030
16 | 
17 | '''{0}\n{1}\n'''.format(1, 2)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
10 10 | 
11 11 | '{0:x}'.format(30)
12 12 | 
13    |-x = '{0}'.format(1)
   13 |+x = '{}'.format(1)
14 14 | 
15 15 | '''{0}\n{1}\n'''.format(1, 2)
16 16 | 

UP030_0.py:15:1: UP030 [*] Use implicit references for positional format fields
   |
15 | x = '{0}'.format(1)
16 | 
17 | '''{0}\n{1}\n'''.format(1, 2)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
18 | 
19 | x = "foo {0}" \
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
12 12 | 
13 13 | x = '{0}'.format(1)
14 14 | 
15    |-'''{0}\n{1}\n'''.format(1, 2)
   15 |+'''{}\n{}\n'''.format(1, 2)
16 16 | 
17 17 | x = "foo {0}" \
18 18 |     "bar {1}".format(1, 2)

UP030_0.py:17:5: UP030 [*] Use implicit references for positional format fields
   |
17 |   '''{0}\n{1}\n'''.format(1, 2)
18 |   
19 |   x = "foo {0}" \
   |  _____^
20 | |     "bar {1}".format(1, 2)
   | |__________________________^ UP030
21 |   
22 |   ("{0}").format(1)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
14 14 | 
15 15 | '''{0}\n{1}\n'''.format(1, 2)
16 16 | 
17    |-x = "foo {0}" \
18    |-    "bar {1}".format(1, 2)
   17 |+x = "foo {}" \
   18 |+    "bar {}".format(1, 2)
19 19 | 
20 20 | ("{0}").format(1)
21 21 | 

UP030_0.py:20:1: UP030 [*] Use implicit references for positional format fields
   |
20 |     "bar {1}".format(1, 2)
21 | 
22 | ("{0}").format(1)
   | ^^^^^^^^^^^^^^^^^ UP030
23 | 
24 | "\N{snowman} {0}".format(1)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
17 17 | x = "foo {0}" \
18 18 |     "bar {1}".format(1, 2)
19 19 | 
20    |-("{0}").format(1)
   20 |+("{}").format(1)
21 21 | 
22 22 | "\N{snowman} {0}".format(1)
23 23 | 

UP030_0.py:22:1: UP030 [*] Use implicit references for positional format fields
   |
22 | ("{0}").format(1)
23 | 
24 | "\N{snowman} {0}".format(1)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP030
25 | 
26 | '{' '0}'.format(1)
   |
   = help: Remove explicit positional indices

ℹ Suggested fix
19 19 | 
20 20 | ("{0}").format(1)
21 21 | 
22    |-"\N{snowman} {0}".format(1)
   22 |+"\N{snowman} {}".format(1)
23 23 | 
24 24 | '{' '0}'.format(1)
25 25 | 

UP030_0.py:24:1: UP030 [*] Use implicit references for positional format fields
   |
24 | "\N{snowman} {0}".format(1)
25 | 
26 | '{' '0}'.format(1)
   | ^^^^^^^^^^^^^^^^^^ UP030
27 | 
28 | # These will not change because we are waiting for libcst to fix this issue:
   |
   = help: Remove explicit positional indices

UP030_0.py:29:5: UP030 [*] Use implicit references for positional format fields
   |
29 |   # https://github.com/Instagram/LibCST/issues/846
30 |   print(
31 |       'foo{0}'
   |  _____^
32 | |     'bar{1}'.format(1, 2)
   | |_________________________^ UP030
33 |   )
   |
   = help: Remove explicit positional indices

UP030_0.py:34:5: UP030 [*] Use implicit references for positional format fields
   |
34 |   print(
35 |       'foo{0}'  # ohai\n"
   |  _____^
36 | |     'bar{1}'.format(1, 2)
   | |_________________________^ UP030
37 |   )
   |
   = help: Remove explicit positional indices


