---
source: crates/ruff_linter/src/rules/refurb/mod.rs
---
FURB145 [*] Prefer `copy` method over slicing
 --> FURB145.py:4:5
  |
3 | # Errors.
4 | a = l[:]
  |     ^^^^
5 | b, c = 1, l[:]
6 | d, e = l[:], 1
  |
help: Replace with `copy()`
  |
3 | # Errors.
  - a = l[:]
4 + a = l.copy()
5 | b, c = 1, l[:]
  |

FURB145 [*] Prefer `copy` method over slicing
 --> FURB145.py:5:11
  |
3 | # Errors.
4 | a = l[:]
5 | b, c = 1, l[:]
  |           ^^^^
6 | d, e = l[:], 1
7 | m = l[::]
  |
help: Replace with `copy()`
  |
4 | a = l[:]
  - b, c = 1, l[:]
5 + b, c = 1, l.copy()
6 | d, e = l[:], 1
  |

FURB145 [*] Prefer `copy` method over slicing
 --> FURB145.py:6:8
  |
4 | a = l[:]
5 | b, c = 1, l[:]
6 | d, e = l[:], 1
  |        ^^^^
7 | m = l[::]
8 | l[:]
  |
help: Replace with `copy()`
  |
5 | b, c = 1, l[:]
  - d, e = l[:], 1
6 + d, e = l.copy(), 1
7 | m = l[::]
  |

FURB145 [*] Prefer `copy` method over slicing
 --> FURB145.py:7:5
  |
5 | b, c = 1, l[:]
6 | d, e = l[:], 1
7 | m = l[::]
  |     ^^^^^
8 | l[:]
9 | print(l[:])
  |
help: Replace with `copy()`
  |
6 | d, e = l[:], 1
  - m = l[::]
7 + m = l.copy()
8 | l[:]
  |

FURB145 [*] Prefer `copy` method over slicing
 --> FURB145.py:8:1
  |
6 | d, e = l[:], 1
7 | m = l[::]
8 | l[:]
  | ^^^^
9 | print(l[:])
  |
help: Replace with `copy()`
  |
7 | m = l[::]
  - l[:]
8 + l.copy()
9 | print(l[:])
  |

FURB145 [*] Prefer `copy` method over slicing
  --> FURB145.py:9:7
   |
 7 | m = l[::]
 8 | l[:]
 9 | print(l[:])
   |       ^^^^
10 |
11 | # False negatives.
   |
help: Replace with `copy()`
   |
8  | l[:]
   - print(l[:])
9  + print(l.copy())
10 |
   |

FURB145 [*] Prefer `copy` method over slicing
  --> FURB145.py:24:5
   |
24 |   b = l[
   |  _____^
25 | |     # text
26 | |     :
27 | | ]
   | |_^
   |
help: Replace with `copy()`
   |
23 |
   - b = l[
   -     # text
   -     :
   - ]
24 + b = l.copy()
   |
note: This is an unsafe fix and may change runtime behavior
