Re: [PATCH 2/6] ci: check formatting of our Rust code
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 7, 2025, 17:38 UTC
- Message-ID
- <xmqqbjmik3y9.fsf@gitster.g>
- In-Reply-To
- <CAPig+cQ7xJky+F=g=NMrN6BQfP+ZV2KF4RF2eLqtULKgMTR5_g@mail.gmail.com>
Eric Sunshine <ericsunshine@gmail.com> writes:
Show 32 quoted lines
> I bring this up because, although it hasn't been such a big deal > with the existing C code, assuming that developers run `rustfmt` > on the code before sending a patch series, then this may become an > issue if different developers have `rustfmt` configured to enforce > different maximum column width, especially since `rustfmt` is > likely to reformat the entire file rather than just the region > that has just been edited. So, if this code gets checked in as-is > with these very wide lines, and then someone else, who has > `rustfmt` configured for 80-columns edits the file, then it > becomes a problem. > > As such, can we also add a project-wide `rustfmt.toml` which, at > minimum, sets the maximum line width to 80? For instance: > > max_width = 80 > > Later in the same thread, I wrote[2]: > > Project guidelines have long suggested 80 columns as a desirable > maximum not only for C code, but for pretty much all other > resources, including shell code, Perl code, and documentation > files. This suggested maximum works well for adherents of > 80-columns and (presumably) hasn't been too onerous for developers > who use wider windows; at least we haven't heard people clamoring > to increase the suggested maximum column limit. As such, it does > not seem far-fetched to expect that the project guidelines > should/could/would also apply to Rust code. > > Unfortunately, what little discussion there was petered out quickly > without resolution, but it seems that it would be a good idea to make > some sort of decision earlier (while there is still very little Rust > code committed to the project) rather than later.
I do not see a particular reason to lift the 80-column limit for a specific language, whether it is Rust or AsciiDoc. I myself use my terminal set to slightly wider than 80 columns these days, but that is primarily to accomodate the fact that code in a patch that are quoted a few times in the discussion would grow from their original line length, not to write pieces of code that are wider than 80 columns myself.
Will it inconvenience wider Rust ecosystem when we get big (meaning, they have to work with our code) and we as the project norm use different line-length setting from others, perhaps by looking too different from everybody else, or something?