3 ms·
> Even if you have, say, 5 sequential related structs, that are all virtually identical, all written on one line so that the similarities and differences are ob
by edflsafoiewq 2y ago
> Even if you have, say, 5 sequential related structs, that are all virtually identical, all written on one line so that the similarities and differences are obvious at a mere glance... Then someone comes through and touches my file, and while they're at it, "fix" the line that went 2 characters past the 80 mark by reformatting the 4th struct to span several lines.
Autoformatters absolutely do this. They do not understand considerations like symmetry.
I am doubtful as to the costs of "somewhere in the codebase there is a missing trailing comma".
- JoshTriplett 2y agoThe wins of autoformatting are 1) never having to have a dispute over formatting or have formatting depend on who last touched code, 2) never manually formatting code or depending on someone's editor configuration, 3) having CI verify formatting, and 4) not having someone (intentionally or unintentionally) make unrelated formatting changes in a commit. Also, autoformatters can be remarkably good. For instance, rustfmt will do things like: x.func(Some(MyStruct { field: big + long + expr, field2, })); rather than mindlessly introducing three levels of indentation.