---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
--- Linter settings ---
-linter.unresolved_target_version = 3.13
+linter.unresolved_target_version = 3.12

--- Summary ---
Removed: 3
Added: 0

--- Removed ---
FURB101 [*] `open` and `read` should be replaced by `Path("file.txt").read_text(newline="\r\n")`
 --> FURB101_3.py:4:6
  |
3 | # FURB101 (newline is supported in read_text on Python 3.13+)
4 | with open("file.txt", newline="\r\n") as f:
  |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5 |     x = f.read()
  |
help: Replace with `Path("file.txt").read_text(newline="\r\n")`
  |
3 | # FURB101 (newline is supported in read_text on Python 3.13+)
  - with open("file.txt", newline="\r\n") as f:
  -     x = f.read()
4 + import pathlib
5 + x = pathlib.Path("file.txt").read_text(newline="\r\n")
6 |
  |


FURB101 [*] `open` and `read` should be replaced by `Path("file.txt").read_text(encoding="utf-8", newline="")`
 --> FURB101_3.py:8:6
  |
7 | # FURB101 (newline with encoding)
8 | with open("file.txt", encoding="utf-8", newline="") as f:
  |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9 |     x = f.read()
  |
help: Replace with `Path("file.txt").read_text(encoding="utf-8", newline="")`
   |
3  | # FURB101 (newline is supported in read_text on Python 3.13+)
4  + import pathlib
5  | with open("file.txt", newline="\r\n") as f:
6  |     x = f.read()
7  |
8  | # FURB101 (newline with encoding)
   - with open("file.txt", encoding="utf-8", newline="") as f:
   -     x = f.read()
9  + x = pathlib.Path("file.txt").read_text(encoding="utf-8", newline="")
10 |
   |


FURB101 [*] `open` and `read` should be replaced by `Path("file.txt").read_text(newline=None)`
  --> FURB101_3.py:12:6
   |
11 | # FURB101 (newline=None is also valid)
12 | with open("file.txt", newline=None) as f:
   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13 |     x = f.read()
   |
help: Replace with `Path("file.txt").read_text(newline=None)`
   |
3  | # FURB101 (newline is supported in read_text on Python 3.13+)
4  + import pathlib
5  | with open("file.txt", newline="\r\n") as f:
--------------------------------------------------------------------------------
12 | # FURB101 (newline=None is also valid)
   - with open("file.txt", newline=None) as f:
   -     x = f.read()
13 + x = pathlib.Path("file.txt").read_text(newline=None)
   |
