Skip to content

Conversation

@olsonjeffery
Copy link
Contributor

Three major pieces:

1. I put the project into a (somewhat opinionated) project structure

Bringing in rust-empty for Makefile usefulness and Cargo because reasons. Right now, rust-empty is the more useful of the two (Mainly I prefer to code w/ -D warnings passed to the compiler, and this isn't possible in cargo right now.

The project is still a single bin project, but the bulk of the code was flipped between the two files (rustfmt.rs contains the impl, which main.rs has main() and nothing else. There is also a test.rs file with a growing suite of test cases

2. Make rustfmt testable

This involved replacing the explicit calls to to println! et al in flush_lines with writes to a &mut Writer that Formatter now takes as a ctor param (I punted on parameterizing Formatter, for now.. doubt it matters).

As mentioned in #1, this means we have tests (huzzah).

3. Features

  • Attributes get a newline afterwards
  • same for doc comments
  • Collapse braces in empty match arms
  • comma for match arms aren't on new lines anymore

Bleh

The crate metadata also has a MIT license on it.. snuck in on accident before I noticed. whoops. feel free to change it or dictate otherwise..

BONUS

once rust-lang/rust#15339 lands, we should get comments and a way to preserve single-whitespace between chunks of code. yay.

pcwalton added a commit that referenced this pull request Jul 8, 2014
Opinionated project re-org, rustfmt is testable, feature work
@pcwalton pcwalton merged commit dfaf7c0 into pcwalton:master Jul 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants