diff options
Diffstat (limited to 'src/tools/clippy/src/docs/multi_assignments.txt')
-rw-r--r-- | src/tools/clippy/src/docs/multi_assignments.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/clippy/src/docs/multi_assignments.txt b/src/tools/clippy/src/docs/multi_assignments.txt new file mode 100644 index 000000000..ed1f1b420 --- /dev/null +++ b/src/tools/clippy/src/docs/multi_assignments.txt @@ -0,0 +1,17 @@ +### What it does +Checks for nested assignments. + +### Why is this bad? +While this is in most cases already a type mismatch, +the result of an assignment being `()` can throw off people coming from languages like python or C, +where such assignments return a copy of the assigned value. + +### Example +``` +a = b = 42; +``` +Use instead: +``` +b = 42; +a = b; +```
\ No newline at end of file |