Using rustfmt systemically


#21

Yeah, I am using nightly by default. This is why I want to add a rustfmt.toml file (and the call to try the config was for everyone).

I don’t think there is a pre-push hook just yet, and but they are pretty easy to add.


#22

Could we use latest rustmft in stable? Not everybody has nightly, expecially an up-to-date nightly.


#23

I use nightly sometimes, but I always compile Pijul with the latest stable (NixOS rocks!). I think sticking to stable is really important.


#24

I just noticed that if we run a beautifier in a pre-commit hook when using git the changes will not be added to the commit itself—they’ll remain unstaged in the working dir. This seems to be intentional, as it’s considered dangerous. It’s preferred to hook the beautifier to the editor (run on save).

Maybe we should adopt this change too? that is:

  1. change our hook to just check whether the code is beautiful or not, refusing to commit if it isn’t.
  2. prevent pijul to include in the commit the changes (if any) done in pre-commit hooks

#25

You are totally right.

I am struggling a bit with contributing with pijul and writing my PhD thesis currently, but I will try to have a look this week-end to propose a standard hook (and to update the changelog notes).


#26

I have started messing around with rustfmt. My current opinion: we should use cargo +nightly fmt, as long as cargo fmt won’t use rustfmt-1.0.


#27

Looking at the state of rustfmt, it seems we would need to improve our nix files a bit before we can consistently use it (Rust doesn’t need Rustup on NixOS, yet can use the binaries downloaded by Rustup).


#28

I will leave that to you, as I am not a NixOS user myself.