vmware-archive / haret

A strongly consistent distributed coordination system, built using proven protocols & implemented in Rust.
461 stars 18 forks source link

Use rustfmt to format code #99

Closed jrgarcia closed 7 years ago

jrgarcia commented 7 years ago

This adds a Makefile target to run rustfmt. It only writes a diff to screen. It could be changed to replace and create backups or overwrite without backups. I chose this to prevent overwriting things that may not be desirable to change.

This also adds a .rustfmt.toml to account for long lines (the default is 100 and errors out on a few lines in the project).

Closes #22

jrgarcia commented 7 years ago

Let me know if you would rather replace or overwrite and I can change that.

andrewjstone commented 7 years ago

Hey @jrgarcia. Thanks for another PR. I think the default of 100 lines should remain and longer lines should be fixed. I also think overwrite is the correct option, since we are using source control. We need to bite the bullet once and format all the code. It's fine to do that now (in a seperate PR) as there is no code yet pending to be merged. As far as the rest of the formatting goes, I came up with this rustfmt.toml for vertree and would like to use it. The only thing I would possibly change is maybe setting fn_call_width = 90 instead of 80, but I'm not dogmatic there. Maybe play with it and see which one you like better. I'll abide by your decision.

If you can modify the PR to use the settings in the vertree toml file, and rebase I'll get this merged in.

Thanks, Andrew

jrgarcia commented 7 years ago

Sounds good. Thanks for reviewing!

jrgarcia commented 7 years ago

I left the fn_call_width at 80 as there didn't seem to be any current issues. The decision for whether that should be changed or not could be discussed once that actually becomes a problem (IMHO).

andrewjstone commented 7 years ago

Can you please rebase this so it's a single commit? If you're not familiar: rebase -i HEAD~2 then replace pick with squash on the second line and hit enter. Then delete the second comment and hit enter again.

Thanks!

andrewjstone commented 7 years ago

Thanks again @jrgarcia