]> git.lizzy.rs Git - rust.git/blob - src/docs/suspicious_op_assign_impl.txt
Auto merge of #9421 - xphoniex:fix-#9420, r=giraffate
[rust.git] / src / docs / suspicious_op_assign_impl.txt
1 ### What it does
2 Lints for suspicious operations in impls of OpAssign, e.g.
3 subtracting elements in an AddAssign impl.
4
5 ### Why is this bad?
6 This is probably a typo or copy-and-paste error and not intended.
7
8 ### Example
9 ```
10 impl AddAssign for Foo {
11     fn add_assign(&mut self, other: Foo) {
12         *self = *self - other;
13     }
14 }
15 ```