pcwalton/rustfmt — pull request #6 by olsonjeffery (2014-07-07 23:46:50+00:00)
Title: Opinionated project re-org, rustfmt is testable, feature work

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 https://github.com/rust-lang/rust/pull/15339 lands, we should get comments and a way to preserve single-whitespace between chunks of code. yay.