summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/src/docs/chars_last_cmp.txt
blob: 4c1d8838973a73d2c2699b68787cfe55d062901c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
### What it does
Checks for usage of `_.chars().last()` or
`_.chars().next_back()` on a `str` to check if it ends with a given char.

### Why is this bad?
Readability, this can be written more concisely as
`_.ends_with(_)`.

### Example
```
name.chars().last() == Some('_') || name.chars().next_back() == Some('-');
```

Use instead:
```
name.ends_with('_') || name.ends_with('-');
```