---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF030 [*] `print()` call in `assert` statement is likely unintentional
 --> RUF030.py:6:14
  |
4 | # Expects:
5 | # - single StringLiteral
6 | assert True, print("This print is not intentional.")
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
7 |
8 | # Concatenated string literals
  |
help: Remove `print`
  |
5 | # - single StringLiteral
  - assert True, print("This print is not intentional.")
6 + assert True, "This print is not intentional."
7 |
  |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:11:14
   |
 9 | # Expects:
10 | # - single StringLiteral
11 | assert True, print("This print" " is not intentional.")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12 |
13 | # Positional arguments, string literals
   |
help: Remove `print`
   |
10 | # - single StringLiteral
   - assert True, print("This print" " is not intentional.")
11 + assert True, "This print is not intentional."
12 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:16:14
   |
14 | # Expects:
15 | # - single StringLiteral concatenated with " "
16 | assert True, print("This print", "is not intentional")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 |
18 | # Concatenated string literals combined with Positional arguments
   |
help: Remove `print`
   |
15 | # - single StringLiteral concatenated with " "
   - assert True, print("This print", "is not intentional")
16 + assert True, "This print is not intentional"
17 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:21:14
   |
19 | # Expects:
20 | # - single stringliteral concatenated with " " only between `print` and `is`
21 | assert True, print("This " "print", "is not intentional.")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22 |
23 | # Positional arguments, string literals with a variable
   |
help: Remove `print`
   |
20 | # - single stringliteral concatenated with " " only between `print` and `is`
   - assert True, print("This " "print", "is not intentional.")
21 + assert True, "This print is not intentional."
22 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:26:14
   |
24 | # Expects:
25 | # - single FString concatenated with " "
26 | assert True, print("This", print.__name__, "is not intentional.")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
27 |
28 | # Mixed brackets string literals
   |
help: Remove `print`
   |
25 | # - single FString concatenated with " "
   - assert True, print("This", print.__name__, "is not intentional.")
26 + assert True, f"This {print.__name__} is not intentional."
27 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:31:14
   |
29 | # Expects:
30 | # - single StringLiteral concatenated with " "
31 | assert True, print("This print", 'is not intentional', """and should be removed""")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32 |
33 | # Mixed brackets with other brackets inside
   |
help: Remove `print`
   |
30 | # - single StringLiteral concatenated with " "
   - assert True, print("This print", 'is not intentional', """and should be removed""")
31 + assert True, "This print is not intentional and should be removed"
32 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:36:14
   |
34 | # Expects:
35 | # - single StringLiteral concatenated with " " and escaped brackets
36 | assert True, print("This print", 'is not "intentional"', """and "should" be 'removed'""")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37 |
38 | # Positional arguments, string literals with a separator
   |
help: Remove `print`
   |
35 | # - single StringLiteral concatenated with " " and escaped brackets
   - assert True, print("This print", 'is not "intentional"', """and "should" be 'removed'""")
36 + assert True, "This print is not \"intentional\" and \"should\" be 'removed'"
37 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:41:14
   |
39 | # Expects:
40 | # - single StringLiteral concatenated with "|"
41 | assert True, print("This print", "is not intentional", sep="|")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
42 |
43 | # Positional arguments, string literals with None as separator
   |
help: Remove `print`
   |
40 | # - single StringLiteral concatenated with "|"
   - assert True, print("This print", "is not intentional", sep="|")
41 + assert True, "This print|is not intentional"
42 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:46:14
   |
44 | # Expects:
45 | # - single StringLiteral concatenated with " "
46 | assert True, print("This print", "is not intentional", sep=None)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 |
48 | # Positional arguments, string literals with variable as separator, needs f-string
   |
help: Remove `print`
   |
45 | # - single StringLiteral concatenated with " "
   - assert True, print("This print", "is not intentional", sep=None)
46 + assert True, "This print is not intentional"
47 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:51:14
   |
49 | # Expects:
50 | # - single FString concatenated with "{U00A0}"
51 | assert True, print("This print", "is not intentional", sep=U00A0)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
52 |
53 | # Unnecessary f-string
   |
help: Remove `print`
   |
50 | # - single FString concatenated with "{U00A0}"
   - assert True, print("This print", "is not intentional", sep=U00A0)
51 + assert True, f"This print{U00A0}is not intentional"
52 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:56:14
   |
54 | # Expects:
55 | # - single StringLiteral
56 | assert True, print(f"This f-string is just a literal.")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57 |
58 | # Positional arguments, string literals and f-strings
   |
help: Remove `print`
   |
55 | # - single StringLiteral
   - assert True, print(f"This f-string is just a literal.")
56 + assert True, "This f-string is just a literal."
57 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:61:14
   |
59 | # Expects:
60 | # - single FString concatenated with " "
61 | assert True, print("This print", f"is not {'intentional':s}")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62 |
63 | # Positional arguments, string literals and f-strings with a separator
   |
help: Remove `print`
   |
60 | # - single FString concatenated with " "
   - assert True, print("This print", f"is not {'intentional':s}")
61 + assert True, f"This print is not {'intentional':s}"
62 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:66:14
   |
64 | # Expects:
65 | # - single FString concatenated with "|"
66 | assert True, print("This print", f"is not {'intentional':s}", sep="|")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67 |
68 | # A single f-string
   |
help: Remove `print`
   |
65 | # - single FString concatenated with "|"
   - assert True, print("This print", f"is not {'intentional':s}", sep="|")
66 + assert True, f"This print|is not {'intentional':s}"
67 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:71:14
   |
69 | # Expects:
70 | # - single FString
71 | assert True, print(f"This print is not {'intentional':s}")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
72 |
73 | # A single f-string with a redundant separator
   |
help: Remove `print`
   |
70 | # - single FString
   - assert True, print(f"This print is not {'intentional':s}")
71 + assert True, f"This print is not {'intentional':s}"
72 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:76:14
   |
74 | # Expects:
75 | # - single FString
76 | assert True, print(f"This print is not {'intentional':s}", sep="|")
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
77 |
78 | # Complex f-string with variable as separator
   |
help: Remove `print`
   |
75 | # - single FString
   - assert True, print(f"This print is not {'intentional':s}", sep="|")
76 + assert True, f"This print is not {'intentional':s}"
77 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:83:14
   |
81 | condition = "True is True"
82 | maintainer = "John Doe"
83 | assert True, print("Unreachable due to", condition, f", ask {maintainer} for advice", sep=U00A0)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84 |
85 | # Empty print
   |
help: Remove `print`
   |
82 | maintainer = "John Doe"
   - assert True, print("Unreachable due to", condition, f", ask {maintainer} for advice", sep=U00A0)
83 + assert True, f"Unreachable due to{U00A0}{condition}{U00A0}, ask {maintainer} for advice"
84 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:88:14
   |
86 | # Expects:
87 | # - `msg` entirely removed from assertion
88 | assert True, print()
   |              ^^^^^^^
89 |
90 | # Empty print with separator
   |
help: Remove `print`
   |
87 | # - `msg` entirely removed from assertion
   - assert True, print()
88 + assert True
89 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
  --> RUF030.py:93:14
   |
91 | # Expects:
92 | # - `msg` entirely removed from assertion
93 | assert True, print(sep=" ")
   |              ^^^^^^^^^^^^^^
94 |
95 | # Custom print function that actually returns a string
   |
help: Remove `print`
   |
92 | # - `msg` entirely removed from assertion
   - assert True, print(sep=" ")
93 + assert True
94 |
   |
note: This is an unsafe fix and may change runtime behavior

RUF030 [*] `print()` call in `assert` statement is likely unintentional
   --> RUF030.py:108:14
    |
106 | # Expects:
107 | # - single StringLiteral
108 | assert True, builtins.print("This print should be removed.")
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
help: Remove `print`
    |
107 | # - single StringLiteral
    - assert True, builtins.print("This print should be removed.")
108 + assert True, "This print should be removed."
    |
note: This is an unsafe fix and may change runtime behavior
