Opinionated project re-org, rustfmt is testable, feature work #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Three major pieces:
1. I put the project into a (somewhat opinionated) project structure
Bringing in
rust-emptyforMakefileusefulness and Cargo because reasons. Right now,rust-emptyis the more useful of the two (Mainly I prefer to code w/-D warningspassed 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.rscontains the impl, whichmain.rshasmain()and nothing else. There is also atest.rsfile with a growing suite of test cases2. Make rustfmt testable
This involved replacing the explicit calls to to
println!et al inflush_lineswith writes to a&mut WriterthatFormatternow takes as a ctor param (I punted on parameterizingFormatter, for now.. doubt it matters).As mentioned in #1, this means we have tests (huzzah).
3. Features
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.