open-flash / swf-parser

Rust and Typescript parsers for SWF
GNU Affero General Public License v3.0
28 stars 8 forks source link

[rs] Add rustfmt to project #81

Closed pheki closed 5 years ago

pheki commented 5 years ago

Hello!

I added rustfmt to the project, customizing the indentation to be 2 spaces. I believe you'd also prefer binop_separator = "Back" (see https://rust-lang.github.io/rustfmt/#binop_separator), but as its still unstable, I left it commented out....

Contributes to issue #25, I was going to also add clippy, but some lints are related to code generated inside nom macros! and as you'll probably have to update nom to 5.0 eventually (which is focused on function instead of macros) I decided to wait...

Also, I ran rustfmt in your name as you're the actual author of those lines...

To format your code just install rustfmt with:

rustup component add rustfmt

And to run its as simple as:

cargo fmt

Thanks for this amazing project 😉

demurgos commented 5 years ago

Thanks for the PR! I'll rebase it on top of #82 and merge it.

demurgos commented 5 years ago

Regarding binop_separator, I believe that "Front" is recommended for readability. If you found operators at the end of the line, they may be mistakes.

Edit: I see, it's because of >> in nom's macros. This should be fixed by #83.

demurgos commented 5 years ago

I rebased your PR, once CI passes I'll merge it. As a side note: prefer to use another branch (not master) when sending PRs to avoid permission issues (there was no problem here, but I had some in the past).