]> git.lizzy.rs Git - rust.git/blob - src/docs/eq_op.txt
Auto merge of #9425 - kraktus:patch-1, r=xFrednet
[rust.git] / src / docs / eq_op.txt
1 ### What it does
2 Checks for equal operands to comparison, logical and
3 bitwise, difference and division binary operators (`==`, `>`, etc., `&&`,
4 `||`, `&`, `|`, `^`, `-` and `/`).
5
6 ### Why is this bad?
7 This is usually just a typo or a copy and paste error.
8
9 ### Known problems
10 False negatives: We had some false positives regarding
11 calls (notably [racer](https://github.com/phildawes/racer) had one instance
12 of `x.pop() && x.pop()`), so we removed matching any function or method
13 calls. We may introduce a list of known pure functions in the future.
14
15 ### Example
16 ```
17 if x + 1 == x + 1 {}
18
19 // or
20
21 assert_eq!(a, a);
22 ```