blob: ea60ea077ab5f320ca82ecec32b57b35a0182ddb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
### What it does
Checks for explicit self-assignments.
### Why is this bad?
Self-assignments are redundant and unlikely to be
intentional.
### Known problems
If expression contains any deref coercions or
indexing operations they are assumed not to have any side effects.
### Example
```
struct Event {
x: i32,
}
fn copy_position(a: &mut Event, b: &Event) {
a.x = a.x;
}
```
Should be:
```
struct Event {
x: i32,
}
fn copy_position(a: &mut Event, b: &Event) {
a.x = b.x;
}
```
|