diff options
Diffstat (limited to 'src/docs/assign_op_pattern.txt')
| -rw-r--r-- | src/docs/assign_op_pattern.txt | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/src/docs/assign_op_pattern.txt b/src/docs/assign_op_pattern.txt deleted file mode 100644 index f355c0cc18d..00000000000 --- a/src/docs/assign_op_pattern.txt +++ /dev/null @@ -1,28 +0,0 @@ -### What it does -Checks for `a = a op b` or `a = b commutative_op a` -patterns. - -### Why is this bad? -These can be written as the shorter `a op= b`. - -### Known problems -While forbidden by the spec, `OpAssign` traits may have -implementations that differ from the regular `Op` impl. - -### Example -``` -let mut a = 5; -let b = 0; -// ... - -a = a + b; -``` - -Use instead: -``` -let mut a = 5; -let b = 0; -// ... - -a += b; -``` \ No newline at end of file |
