blob: 47a2e8575228542722423914d378f5d4cdbe436f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
### What it does
Checks for items that implement `.len()` but not
`.is_empty()`.
### Why is this bad?
It is good custom to have both methods, because for
some data structures, asking about the length will be a costly operation,
whereas `.is_empty()` can usually answer in constant time. Also it used to
lead to false positives on the [`len_zero`](#len_zero) lint – currently that
lint will ignore such entities.
### Example
```
impl X {
pub fn len(&self) -> usize {
..
}
}
```
|