---
source: crates/ruff_linter/src/rules/ruff/mod.rs
---
RUF055 [*] Plain string pattern passed to `re` function
 --> RUF055_2.py:7:1
  |
6 | # this should be replaced with `"abc" not in s`
7 | re.search("abc", s) is None
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
help: Replace with `"abc" not in s`
  |
6 | # this should be replaced with `"abc" not in s`
  - re.search("abc", s) is None
7 + "abc" not in s
8 |
  |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:11:1
   |
10 | # this should be replaced with `"abc" in s`
11 | re.search("abc", s) is not None
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `"abc" in s`
   |
10 | # this should be replaced with `"abc" in s`
   - re.search("abc", s) is not None
11 + "abc" in s
12 |
   |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:15:1
   |
14 | # this should be replaced with `not s.startswith("abc")`
15 | re.match("abc", s) is None
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `not s.startswith("abc")`
   |
14 | # this should be replaced with `not s.startswith("abc")`
   - re.match("abc", s) is None
15 + not s.startswith("abc")
16 |
   |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:19:1
   |
18 | # this should be replaced with `s.startswith("abc")`
19 | re.match("abc", s) is not None
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `s.startswith("abc")`
   |
18 | # this should be replaced with `s.startswith("abc")`
   - re.match("abc", s) is not None
19 + s.startswith("abc")
20 |
   |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:23:1
   |
22 | # this should be replaced with `s != "abc"`
23 | re.fullmatch("abc", s) is None
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `s != "abc"`
   |
22 | # this should be replaced with `s != "abc"`
   - re.fullmatch("abc", s) is None
23 + s != "abc"
24 |
   |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:27:1
   |
26 | # this should be replaced with `s == "abc"`
27 | re.fullmatch("abc", s) is not None
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
help: Replace with `s == "abc"`
   |
26 | # this should be replaced with `s == "abc"`
   - re.fullmatch("abc", s) is not None
27 + s == "abc"
28 |
   |

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:33:5
   |
31 |   # expression being replaced (which we'd lose)
32 |   if (
33 | /     re.fullmatch(
34 | |         "a really really really really long string",
35 | |         s,
36 | |     )
37 | |     # with a comment here
38 | |     is None
   | |___________^
39 |   ):
40 |       pass
   |
help: Replace with `s != "a really really really really long string"`
   |
32 | if (
   -     re.fullmatch(
   -         "a really really really really long string",
   -         s,
   -     )
   -     # with a comment here
   -     is None
33 +     s != "a really really really really long string"
34 | ):
   |
note: This is an unsafe fix and may change runtime behavior

RUF055 [*] Plain string pattern passed to `re` function
  --> RUF055_2.py:46:5
   |
44 |   # expression)
45 |   if (  # leading
46 | /     re.fullmatch(
47 | |         "a really really really really long string",
48 | |         s,
49 | |     )
50 | |     is None  # trailing
   | |___________^
51 |   ):
52 |       pass
   |
help: Replace with `s != "a really really really really long string"`
   |
45 | if (  # leading
   -     re.fullmatch(
   -         "a really really really really long string",
   -         s,
   -     )
   -     is None  # trailing
46 +     s != "a really really really really long string"  # trailing
47 | ):
   |
