Commit Graph

246 Commits

Author SHA1 Message Date
Nick Cameron
95d6b64829 Replace WriteMode with EmitMode and backup bool 2018-05-21 14:14:09 +12:00
Nick Cameron
843c12601a Use our own FileName struct rather than exporting libsyntax's 2018-05-21 12:08:39 +12:00
Nick Cameron
539d4d9665 Refactor CliOptions 2018-05-21 11:27:25 +12:00
Nick Cameron
432b1cb253 Rationalise error types
cc #2639
2018-05-21 08:58:53 +12:00
Nick Cameron
1452349966 Exit with 1 for license check in --check mode
Closes #2707
2018-05-18 15:30:32 +12:00
Nick Cameron
a3c85cdc41 Reorder the --help message 2018-05-14 11:07:54 +12:00
Nick Cameron
6d0695303a Make some write modes unstable 2018-05-14 10:55:16 +12:00
Nick Cameron
3b23a98d00 Support unstable options
cc #1976
2018-05-14 10:20:51 +12:00
Nick Cameron
5d9f5aa05a Replace --write-mode with --emit
cc #1976
2018-05-13 14:13:24 +12:00
Nick Cameron
8396da1882 Add --backup flag 2018-05-13 13:18:08 +12:00
Seiichi Uchida
1b1eccc553
Fix build failure (#2699) 2018-05-12 10:36:34 +09:00
Nick Cameron
eca7796fb1 Replace --dump-minimal-config and --dump-default-config with --print-config
cc #1976
2018-05-11 20:43:08 +12:00
Nick Cameron
4d9de48e06 Add --check flag.
cc #1976
2018-05-11 20:26:00 +12:00
Nick Cameron
798bffb8b1 --help options
cc #1976
2018-05-11 20:12:16 +12:00
Nick Cameron
1869888b1a Remove --verbose-diff
Use `--verbose` instead

cc #1976
2018-05-11 13:58:34 +12:00
Nick Cameron
55ac062da0 Add --quiet flag, remove Plain write mode
cc #1976
2018-05-11 13:50:30 +12:00
topecongiro
1f738ea208 Cargo fmt 2018-05-06 15:22:29 +09:00
Nick Cameron
e554d8617d
Merge branch 'master' into imports_indent 2018-04-30 11:50:53 +12:00
csmoe
be3be582cc set stdin default config path to curr 2018-04-29 21:40:37 +08:00
csmoe
f7415bcea2 update self format 2018-04-29 20:53:31 +08:00
Tibo
b7df23c3d5
Replace completely std::error with failure crate 2018-04-26 13:48:48 +10:00
Nick Cameron
ca610d35b3 Refactor to make a sensible public API
0.5 - lots of breaking changes

cc #2639
2018-04-20 21:52:02 +12:00
Nick Cameron
6a31741eaa Get exit codes right 2018-04-20 14:17:56 +12:00
Nick Cameron
5194984812 Add a verbose-diff option
And don't print end of line characters by default in diffs

cc #2536
2018-04-20 14:02:44 +12:00
Nick Cameron
7a886e8fe5 Refactoring around write mode in main 2018-04-20 13:42:27 +12:00
Nick Cameron
a73f14aa95 Trivial refactoring in bin 2018-04-20 13:24:45 +12:00
David Barsky
f9532ba8d7 Implemented rough draft of check write mode. (#2539)
* Add rough draft of `check` mode. Not unit tested.

* Added assert-cli; simple test case for `--write-mode=check`

* Lightly documented `check` WriteMode

* wrote clearer phrasing for config::options::WriteMode::Check

* Implemented default for WriteMode where default is Overwrite

* Simplified exit code handling

* updated README.md as per @nrc' comment

* collapsed exit-code handling

* Removed write_mode from Summary, introduced partial option parsing earlier

* Handle write-mode parsing in a slightly better way.
2018-04-20 11:14:11 +12:00
Seiichi Uchida
8b731db6ba Output xml header and footer only once 2018-04-12 13:45:12 +09:00
Peter Huene
8208f8aa01
Suppress unstable config options by default.
This commit suppresses the output of unstable config options by default.

Users can specify the `--unstable-features` option to show the config options
that are unstable.

Fixes #2611.
2018-04-09 12:45:56 -07:00
Ivan Sorokin
3fe2233fd3 Fix error_on_unformatted and skip_children override
Currently, error_on_unformatted and skip_children options
specified in the config file are discarded.
This happens because CLI options have a higher priority,
but we coerce an absence of a `bool` option to `false`.
In this scenario, an absence of a `bool` option is indistinguishable
from explicetely set as `false`. We should coerce it to `None` instead,
so it does not override the one in the config file.
2018-04-05 23:13:17 +02:00
Marthog
bc05621f9b Let --dump-default-config default to stdout #2579 (#2586) 2018-04-01 23:15:25 +09:00
Nick Cameron
50c95a074a cargo fmt 2018-03-20 09:27:31 +13:00
Nick Cameron
a76d9b529a format code and tests 2018-03-20 09:27:31 +13:00
Seiichi Uchida
ca6fc67e60 Fix print_version 2018-03-17 12:16:15 +09:00
Seiichi Uchida
84ad70c151 Add ignore config option
For example, with the following config file, rustfmt will ignore `src/types.rs`,
`src/foo/bar.rs` and every file under `examples/` directory.

```toml
[ignore]
files = [
    "src/types.rs",
    "src/foo/bar.rs",
]
directories = [
    "examples",
]
```
2018-03-09 13:37:52 +09:00
Seiichi Uchida
a6b574bfa7 Cargo update and cargo clippy 2018-03-08 18:10:23 +09:00
Nick Cameron
39301ae5f2 Go back to a non-workspace structure
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro
9c9b31c13b Create git-rustfmt crate 2018-02-07 22:49:56 +09:00
topecongiro
d28d7fee89 Create rustfmt-format-diff crate 2018-02-07 22:49:43 +09:00
topecongiro
d18cd1d11c Create rustfmt-bin crate 2018-02-07 22:49:26 +09:00
topecongiro
3920282deb Create cargo-fmt crate 2018-02-07 22:49:10 +09:00
Ingvar Stepanyan
5bd036fcac Optimise common => {{ macro pattern 2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9318b4d2cf Update some macro tests 2018-02-04 11:53:10 +00:00
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand 2018-02-01 15:20:01 +13:00
Alex McArther
6d294e6bcb Make rustfmt-bin's CARGO_PKG_VERSION envvar optional 2018-01-23 07:55:50 -08:00
Seiichi Uchida
154bf8e1af Cargo fmt 2018-01-22 13:05:18 +09:00
Joost Hopmans
361a30b159 Rename git-fmt to git-rustfmt 2018-01-03 14:15:45 +01:00
Seiichi Uchida
4604fea0a0 Refactoring
1. Cargo clippy
2. Run 'cargo fmt' with import reordering options set to `true`.
3. Factor out `rewrite_lifetime_param()`.
2017-12-25 00:13:59 +09:00
Seiichi Uchida
0ef2b99b74 Remove workspace membership check 2017-12-23 12:24:58 +09:00
Nick Cameron
5725f41974
Merge pull request #2298 from davidalber/fix-2269
Adding --version to cargo-fmt
2017-12-22 21:55:07 +13:00