Fix possible_missing_comma false positives

`possible_missing_comma` should only trigger when the binary operator has
unary equivalent. Otherwise, it's not possible to insert a comma without
breaking compilation. The operators identified were `+`, `&`, `*` and `-`.

This fixes the specific examples given in issues #3244 and #3396
but doesn't address the conflict this lint has with the style of starting
a line with a binary operator.
This commit is contained in:
Michael Wright 2018-11-04 10:02:49 +02:00
parent a07c271559
commit 0c1ffc1d1f
2 changed files with 35 additions and 13 deletions

View file

@ -112,4 +112,16 @@ fn main() {
1 + 2, 3 +
4, 5 + 6,
];
// don't lint for bin op without unary equiv
// issue 3244
vec![
1
/ 2,
];
// issue 3396
vec![
true
| false,
];
}