assign_op_constants
code:text
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;
// ...
// Bad
a = a + b;
// Good
a += b;
メモ
While forbidden by the spec, OpAssign traits may have implementations that differ from the regular Op impl. そうなんだ、と思ったけどそれはそうか。とりあえず再現コード書いた。けど今PlaygroundのClippy死んでて気軽に確認できない。てか仕様どこ?