]> git.lizzy.rs Git - rust.git/blob - src/docs/multi_assignments.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / multi_assignments.txt
1 ### What it does
2 Checks for nested assignments.
3
4 ### Why is this bad?
5 While this is in most cases already a type mismatch,
6 the result of an assignment being `()` can throw off people coming from languages like python or C,
7 where such assignments return a copy of the assigned value.
8
9 ### Example
10 ```
11 a = b = 42;
12 ```
13 Use instead:
14 ```
15 b = 42;
16 a = b;
17 ```