graphql-rust / graphql-parser

A graphql query language and schema definition language parser and formatter for rust
Apache License 2.0
355 stars 77 forks source link

Thoughts on rustfmt? #39

Closed davidpdrsn closed 4 years ago

davidpdrsn commented 4 years ago

@tailhook I notice the codebase isn't currently formatted with rustfmt. Any particular reason for that or would you be open to a PR that formats everything?

tailhook commented 4 years ago

Generally I don't think rustfmt is useful enough. Most people are able to format code good enough. And in many cases rustfmt ruins readability, such as when we explicitly align tests as one-liners vertically for easier skimming and comparing. Or when we group things in long chain of dotted-calls to make either error reporting or any other aspect of call chain clearer.

davidpdrsn commented 4 years ago

It's of course your decision but I personally think it's worth it given it's pretty standard in the rust community. I personally have my editor configured to run rustfmt when I save a file and I imagine lots of other people do. So for those people it would make contributing easier.

But you're free to close this issue if you still disagree. I was just wondering.

tailhook commented 4 years ago

I personally have my editor configured to run rustfmt when I save a file and I imagine lots of other people do.

I don't find this is hard enough to tune this feature based on project. And I find pluralism useful. As much as I respect rules of the projects which use rustfmt I also expect them to respect of rule: do not reformat the code you don't contribute.

it's also not that enforcing rustfmt makes contributions easier. There's evidence that for some people it's quite opposite.