E0015
ErrorSafe fix
, between fields, variants or arms
ErrorSafe fixEach field of a class, each variant of an enum and each arm of a match stands on its own line. A ; can stand in for the line break, but a , cannot.
Why
A line break separates the members of a class or an enum and the arms of a match, as it separates statements. Fields, variants or arms written with commas would be a second way to say the same thing. The fix keeps the separator and changes the comma: a , in the middle of a line becomes ;, and a , at the end of a line or before } goes, because a ; there would be unnecessary.
Broken
class Point {
x: i64, y: i64
}
fn main() {
let p = Point(x: 1, y: 2)
print(p.x + p.y)
}
What sisu says
error[E0015]: fields are separated by a line break or `;`, not `,` --> E0015.sisu:2:11 | 2 | x: i64, y: i64 | ^ | = help: put each field on its own line help: replace the `,` with `;` | 2 - x: i64, y: i64 2 + x: i64; y: i64 | sisu: 1 error sisu: for more on a code, run `sisu explain <code>`: E0015
Fixed
class Point {
x: i64; y: i64
}
fn main() {
let p = Point(x: 1, y: 2)
print(p.x + p.y)
}
Sisu