blob: 3d9e49dd39eb781c0945ddb1eb33a2be7f34ce54 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
### What it does
Checks for slice operations on strings
### Why is this bad?
UTF-8 characters span multiple bytes, and it is easy to inadvertently confuse character
counts and string indices. This may lead to panics, and should warrant some test cases
containing wide UTF-8 characters. This lint is most useful in code that should avoid
panics at all costs.
### Known problems
Probably lots of false positives. If an index comes from a known valid position (e.g.
obtained via `char_indices` over the same string), it is totally OK.
# Example
```
&"Ölkanne"[1..];
```
|