---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF010 [*] Use explicit conversion flag
  --> RUF010.py:9:4
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
   |    ^^^^^^^^
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |
help: Replace with conversion flag
   |
8  |
   - f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
9  + f"{bla!s}, {repr(bla)}, {ascii(bla)}"  # RUF010
10 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:9:16
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
   |                ^^^^^^^^^
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |
help: Replace with conversion flag
   |
8  |
   - f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
9  + f"{str(bla)}, {bla!r}, {ascii(bla)}"  # RUF010
10 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:9:29
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
   |                             ^^^^^^^^^^
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |
help: Replace with conversion flag
   |
8  |
   - f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
9  + f"{str(bla)}, {repr(bla)}, {bla!a}"  # RUF010
10 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:11:4
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |    ^^^^^^^^^^^
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
10 |
   - f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
11 + f"{d['a']!s}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
12 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:11:19
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |                   ^^^^^^^^^^^^
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
10 |
   - f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
11 + f"{str(d['a'])}, {d['b']!r}, {ascii(d['c'])}"  # RUF010
12 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:11:35
   |
 9 | f"{str(bla)}, {repr(bla)}, {ascii(bla)}"  # RUF010
10 |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
   |                                   ^^^^^^^^^^^^^
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
10 |
   - f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
11 + f"{str(d['a'])}, {repr(d['b'])}, {d['c']!a}"  # RUF010
12 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:13:5
   |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |     ^^^^^^^^
14 |
15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
12 |
   - f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
13 + f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
14 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:13:19
   |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |                   ^^^^^^^^^
14 |
15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
12 |
   - f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
13 + f"{(str(bla))}, {bla!r}, {(ascii(bla))}"  # RUF010
14 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:13:34
   |
11 | f"{str(d['a'])}, {repr(d['b'])}, {ascii(d['c'])}"  # RUF010
12 |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |                                  ^^^^^^^^^^
14 |
15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |
help: Replace with conversion flag
   |
12 |
   - f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
13 + f"{(str(bla))}, {(repr(bla))}, {bla!a}"  # RUF010
14 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:15:14
   |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
14 |
15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |              ^^^^^^^^^
16 |
17 | f"{foo(bla)}"  # OK
   |
help: Replace with conversion flag
   |
14 |
   - f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
15 + f"{bla!s}, {bla!r}, {(ascii(bla))}"  # RUF010
16 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:15:29
   |
13 | f"{(str(bla))}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
14 |
15 | f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
   |                             ^^^^^^^^^^
16 |
17 | f"{foo(bla)}"  # OK
   |
help: Replace with conversion flag
   |
14 |
   - f"{bla!s}, {(repr(bla))}, {(ascii(bla))}"  # RUF010
15 + f"{bla!s}, {(repr(bla))}, {bla!a}"  # RUF010
16 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:35:20
   |
33 |     f"Member of tuple mismatches type at index {i}. Expected {of_shape_i}. Got "
34 |     " intermediary content "
35 |     f" that flows {repr(obj)} of type {type(obj)}.{additional_message}"  # RUF010
   |                    ^^^^^^^^^
36 | )
   |
help: Replace with conversion flag
   |
34 |     " intermediary content "
   -     f" that flows {repr(obj)} of type {type(obj)}.{additional_message}"  # RUF010
35 +     f" that flows {obj!r} of type {type(obj)}.{additional_message}"  # RUF010
36 | )
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:40:4
   |
39 | # https://github.com/astral-sh/ruff/issues/16325
40 | f"{str({})}"
   |    ^^^^^^^
41 |
42 | f"{str({} | {})}"
   |
help: Replace with conversion flag
   |
39 | # https://github.com/astral-sh/ruff/issues/16325
   - f"{str({})}"
40 + f"{ {}!s}"
41 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:42:4
   |
40 | f"{str({})}"
41 |
42 | f"{str({} | {})}"
   |    ^^^^^^^^^^^^
43 |
44 | import builtins
   |
help: Replace with conversion flag
   |
41 |
   - f"{str({} | {})}"
42 + f"{ {} | {}!s}"
43 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:46:4
   |
44 | import builtins
45 |
46 | f"{builtins.repr(1)}"
   |    ^^^^^^^^^^^^^^^^
47 |
48 | f"{repr(1)=}"
   |
help: Replace with conversion flag
   |
45 |
   - f"{builtins.repr(1)}"
46 + f"{1!r}"
47 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:50:4
   |
48 | f"{repr(1)=}"
49 |
50 | f"{repr(lambda: 1)}"
   |    ^^^^^^^^^^^^^^^
51 |
52 | f"{repr(x := 2)}"
   |
help: Replace with conversion flag
   |
49 |
   - f"{repr(lambda: 1)}"
50 + f"{(lambda: 1)!r}"
51 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:52:4
   |
50 | f"{repr(lambda: 1)}"
51 |
52 | f"{repr(x := 2)}"
   |    ^^^^^^^^^^^^
53 |
54 | f"{str(object=3)}"
   |
help: Replace with conversion flag
   |
51 |
   - f"{repr(x := 2)}"
52 + f"{(x := 2)!r}"
53 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:54:4
   |
52 | f"{repr(x := 2)}"
53 |
54 | f"{str(object=3)}"
   |    ^^^^^^^^^^^^^
55 |
56 | f"{str(x for x in [])}"
   |
help: Replace with conversion flag
   |
53 |
   - f"{str(object=3)}"
54 + f"{3!s}"
55 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:56:4
   |
54 | f"{str(object=3)}"
55 |
56 | f"{str(x for x in [])}"
   |    ^^^^^^^^^^^^^^^^^^
57 |
58 | f"{str((x for x in []))}"
   |
help: Replace with conversion flag
   |
55 |
   - f"{str(x for x in [])}"
56 + f"{(x for x in [])!s}"
57 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:58:4
   |
56 | f"{str(x for x in [])}"
57 |
58 | f"{str((x for x in []))}"
   |    ^^^^^^^^^^^^^^^^^^^^
59 |
60 | # Debug text cases - should not trigger RUF010
   |
help: Replace with conversion flag
   |
57 |
   - f"{str((x for x in []))}"
58 + f"{(x for x in [])!s}"
59 |
   |

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:69:4
   |
68 |   # Fix should be unsafe when it deletes a comment (https://github.com/astral-sh/ruff/issues/19745)
69 |   f"{ascii(
   |  ____^
70 | |     # comment
71 | |     1
72 | | )}"
   | |_^
73 |
74 |   f"{repr(
   |
help: Replace with conversion flag
   |
68 | # Fix should be unsafe when it deletes a comment (https://github.com/astral-sh/ruff/issues/19745)
   - f"{ascii(
   -     # comment
   -     1
   - )}"
69 + f"{1!a}"
70 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:74:4
   |
72 |   )}"
73 |
74 |   f"{repr(
   |  ____^
75 | |     # comment
76 | |     1
77 | | )}"
   | |_^
78 |
79 |   f"{str(
   |
help: Replace with conversion flag
   |
73 |
   - f"{repr(
   -     # comment
   -     1
   - )}"
74 + f"{1!r}"
75 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:79:4
   |
77 |   )}"
78 |
79 |   f"{str(
   |  ____^
80 | |     # comment
81 | |     1
82 | | )}"
   | |_^
83 |
84 |   # Fix should be unsafe when it deletes comments after the argument
   |
help: Replace with conversion flag
   |
78 |
   - f"{str(
   -     # comment
   -     1
   - )}"
79 + f"{1!s}"
80 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:85:4
   |
84 |   # Fix should be unsafe when it deletes comments after the argument
85 |   f"{ascii(1  # comment
   |  ____^
86 | | )}"
   | |_^
87 |
88 |   f"{repr((
   |
help: Replace with conversion flag
   |
84 | # Fix should be unsafe when it deletes comments after the argument
   - f"{ascii(1  # comment
   - )}"
85 + f"{1!a}"
86 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:88:4
   |
86 |   )}"
87 |
88 |   f"{repr((
   |  ____^
89 | |     1
90 | | )  # comment
91 | | )}"
   | |_^
92 |
93 |   f"{str((
   |
help: Replace with conversion flag
   |
87 |
   - f"{repr((
88 + f"{(
89 |     1
   - )  # comment
   - )}"
90 + )!r}"
91 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
  --> RUF010.py:93:4
   |
91 |   )}"
92 |
93 |   f"{str((
   |  ____^
94 | |     1
95 | | )
96 | |     # comment
97 | | )}"
   | |_^
98 |
99 |   # Fix should be safe when the comment is preserved inside extra parentheses
   |
help: Replace with conversion flag
   |
92 |
   - f"{str((
93 + f"{(
94 |     1
   - )
   -     # comment
   - )}"
95 + )!s}"
96 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF010 [*] Use explicit conversion flag
   --> RUF010.py:100:4
    |
 99 |   # Fix should be safe when the comment is preserved inside extra parentheses
100 |   f"{ascii((
    |  ____^
101 | |     # comment
102 | |     1
103 | | ))}"
    | |__^
104 |
105 |   f"{repr((
    |
help: Replace with conversion flag
    |
99  | # Fix should be safe when the comment is preserved inside extra parentheses
    - f"{ascii((
100 + f"{(
101 |     # comment
102 |     1
    - ))}"
103 + )!a}"
104 |
    |

RUF010 [*] Use explicit conversion flag
   --> RUF010.py:105:4
    |
103 |   ))}"
104 |
105 |   f"{repr((
    |  ____^
106 | |     1  # comment
107 | | ))}"
    | |__^
108 |
109 |   f"{repr((
    |
help: Replace with conversion flag
    |
104 |
    - f"{repr((
105 + f"{(
106 |     1  # comment
    - ))}"
107 + )!r}"
108 |
    |

RUF010 [*] Use explicit conversion flag
   --> RUF010.py:109:4
    |
107 |   ))}"
108 |
109 |   f"{repr((
    |  ____^
110 | |     1
111 | |     # comment
112 | | ))}"
    | |__^
113 |
114 |   f"{repr((
    |
help: Replace with conversion flag
    |
108 |
    - f"{repr((
109 + f"{(
110 |     1
111 |     # comment
    - ))}"
112 + )!r}"
113 |
    |

RUF010 [*] Use explicit conversion flag
   --> RUF010.py:114:4
    |
112 |   ))}"
113 |
114 |   f"{repr((
    |  ____^
115 | |     # comment
116 | |     1
117 | | ))}"
    | |__^
118 |
119 |   f"{str((
    |
help: Replace with conversion flag
    |
113 |
    - f"{repr((
114 + f"{(
115 |     # comment
116 |     1
    - ))}"
117 + )!r}"
118 |
    |

RUF010 [*] Use explicit conversion flag
   --> RUF010.py:119:4
    |
117 |   ))}"
118 |
119 |   f"{str((
    |  ____^
120 | |     # comment
121 | |     1
122 | | ))}"
    | |__^
    |
help: Replace with conversion flag
    |
118 |
    - f"{str((
119 + f"{(
120 |     # comment
121 |     1
    - ))}"
122 + )!s}"
    |
