Stream: t-compiler

Topic: rustfmt-on-rust-lang/rust


davidtwco (Sep 25 2018 at 20:39, on Zulip):

Have there ever been any discussions about formatting all of the compiler with rustfmt so it is all standardized and the same? Or are there reasons why that cannot be done?

davidtwco (Sep 25 2018 at 20:39, on Zulip):

Just something I was curious about.

Jake Goulding (Sep 25 2018 at 20:45, on Zulip):

I thought that it's been happening piecemeal.

Jake Goulding (Sep 25 2018 at 20:45, on Zulip):

The big "reason" I can see is that it will likely break every outstanding PR ;-)

davidtwco (Sep 25 2018 at 20:46, on Zulip):

Yeah, I was thinking that it could be done module-by-module, a PR that formats it all and then adds a check to tidy so that it can't regress.

davidtwco (Sep 25 2018 at 20:47, on Zulip):

If it has been happening piecemeal then am I right in thinking that it isn't being checked by tidy to make sure code is kept formatted by rustfmt?

Jake Goulding (Sep 25 2018 at 20:47, on Zulip):

I have not seen any such checks (but I'm a lightweight bystander)

Jake Goulding (Sep 25 2018 at 20:48, on Zulip):

For example - https://github.com/rust-lang/rust/commit/d0c1e5a99e3a9b0d57e8f1deea3c76bd1fb7c0e9

nikomatsakis (Sep 26 2018 at 17:18, on Zulip):

@davidtwco I would really like to see this happen. I want to be able to enable rustfmt-on-save so badly.

Tom Tromey (Sep 26 2018 at 17:32, on Zulip):

What would it take? A flag day could be handled by writing a script people could use to git filter-branch on their pending patches. Or, maybe it could be done directory-by-directory somehow?

memoryruins (Sep 26 2018 at 18:27, on Zulip):

maybe it could be done gradually

varkor (Sep 26 2018 at 18:30, on Zulip):

there's this issue: https://github.com/rust-lang/rust/issues/49567

varkor (Sep 26 2018 at 18:31, on Zulip):

it does mess git blame up entirely, which can be annoying

varkor (Sep 26 2018 at 18:31, on Zulip):

it's not checked in tidy at the moment, but it would need to be

memoryruins (Sep 26 2018 at 18:35, on Zulip):
nikomatsakis (Sep 26 2018 at 18:44, on Zulip):

I think once the Edition is released we should just do a flag day and be done with it

memoryruins (Sep 26 2018 at 18:44, on Zulip):

for tidy, running rustfmt as a user could be something like --bless, then for travis, if tidy runs rutstfm and theres a diff, tidy fails (as if it wasnt mercilous enough)

davidtwco (Sep 26 2018 at 18:44, on Zulip):

I think that just running rustfmt on a module in a PR and adding a tidy check for new code. After that everyone will just get used to running that on everything for tidy to pass.

memoryruins (Sep 26 2018 at 18:48, on Zulip):

flag day would pull the bandaid

Alexander Regueiro (Sep 27 2018 at 22:07, on Zulip):

Is there any issue with the CI running rustfmt itself? Is it simply that we don't fully trust rustfmt yet?

davidtwco (Sep 27 2018 at 22:13, on Zulip):

I don't think it is desirable for the CI to actually reformat code, but I think there's some consensus that the CI would run rustfmt in a mode where it will check that a code is formatted. Much in the same way tidy won't wrap lines for you, just tell you that the lines are too long.

Alexander Regueiro (Sep 27 2018 at 22:27, on Zulip):

And why isn't it desirable?

Jake Goulding (Sep 27 2018 at 23:50, on Zulip):

Many people (myself included) are pretty wary of automated tools creating git commits containing actual substance.

Last update: Nov 22 2019 at 04:50UTC