When defining arrays in Rust, it is possible to forget a comma between elements, especially when the elements are binary operator expressions that span multiple lines. This can lead to unexpected results, causing logical errors or runtime issues.
The origin of this problem is often due to oversight or formatting changes that split expressions across lines without adding the necessary comma.
To fix this issue, add commas after each element or write the entire array on a single line.
let a = &[
-1, -2, -3 // Noncompliant: <= no comma here
-4, -5, -6
];
let a = &[
-1, -2, -3,
-4, -5, -6,
];