Commit Graph

290 Commits

Author SHA1 Message Date
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
David Alber
09d0ca4892 Using common execute rustfmt function 2017-12-20 23:24:28 -08:00
David Alber
f17556966c Reusing status-handling function 2017-12-20 22:36:36 -08:00
David Alber
655022c42b Factoring out status code values 2017-12-20 21:53:33 -08:00
David Alber
6aaed5b08f Adding --version option to cargo-fmt 2017-12-20 21:48:59 -08:00
Seiichi Uchida
85ef4638b6 Make 'cargo fmt' formats every workspace member 2017-12-20 22:47:51 +09:00
Oliver Schneider
fad903fd14 Move from String to PathBuf where applicable 2017-12-15 10:26:19 +09:00
Nick Cameron
4ee7911f4b
Merge pull request #2271 from topecongiro/refactorings
Refactorings from cargo clippy etc.
2017-12-15 08:53:48 +13:00
Seiichi Uchida
516f15aba1 Cargo clippy 2017-12-12 13:48:12 +09:00
topecongiro
32804c1f09 Do not print usage when rustfmt failed 2017-12-12 00:54:37 +09:00
Seiichi Uchida
e45c0c4815 Rename error_on_unformatted_comments_or_strings to error_on_unformatted 2017-12-11 11:48:17 +09:00
Seiichi Uchida
d3ee7f3f06 Set error_on_unformatted_comments_or_strings to true when --error-on-unformatted
option is passed
2017-12-11 11:48:17 +09:00
Seiichi Uchida
93a75de18e Print command line options in alphabetical order 2017-12-11 11:48:17 +09:00
Seiichi Uchida
1e982c66a0 Fix a typo 2017-12-11 11:48:17 +09:00
Seiichi Uchida
cbd3608c30 Organize command line options and start with upper case 2017-12-11 11:48:17 +09:00
Seiichi Uchida
d17168f4ba Add error-on-unformatted command line option 2017-12-11 11:48:17 +09:00
Seiichi Uchida
3ebe054362 Replace into() on &str with to_owned() 2017-12-08 13:07:42 +09:00
Seiichi Uchida
b8448f6223 Use package name instead of target name for --package filter 2017-12-06 12:41:04 +09:00
Nick Cameron
b07e4339f0
Merge pull request #2221 from topecongiro/rfc/blank-lines
Keep vertical spaces between items or statements within range
2017-12-06 15:52:19 +13:00
Seiichi Uchida
65c90dc08c Do not pass files as arguments to rustfmt when dumping the default config 2017-12-05 08:01:29 +09:00
Seiichi Uchida
89f27764ed Cargo fmt and update tests 2017-12-02 17:45:39 +09:00
topecongiro
22c9025027 Format source codes 2017-11-30 18:00:49 +09:00
topecongiro
8b53d7806c Cargo fmt 2017-11-29 17:37:51 +09:00
topecongiro
f06cb34022 Replace TargetKind with simple String 2017-11-27 22:09:01 +09:00
topecongiro
a5b647faa7 Allow '--package <package>' 2017-11-27 19:29:26 +09:00
topecongiro
bf87d9b79f Rename WorkspaceHitlist to CargoFmtStrategy 2017-11-27 18:57:46 +09:00
topecongiro
fbe06c6f77 Random formatting 2017-11-27 18:48:16 +09:00
topecongiro
33ab1f4927 Use cargo_metadata crate over json crate 2017-11-27 18:47:07 +09:00
topecongiro
58e83fb426 Implement PartialEq, Eq and Hash trait for Target
and move Target::from_json() to TargetKind::from_str()
2017-11-27 18:45:26 +09:00
topecongiro
1b1122654f Add cargo_metadata to dependency 2017-11-27 18:37:21 +09:00
topecongiro
34c2499029 Cargo fmt 2017-11-16 17:43:06 +09:00
topecongiro
b1a6dd6b83 Cargo fmr & update tests
Note that we are forcing vertical layout when there are attributes on top of a
variant.
2017-11-16 16:07:15 +09:00
clippered
794a215b27 rename to use_colored_tty; used match as well 2017-11-13 20:18:05 +11:00
clippered
d2f2f25463 add cli option for color 2017-11-13 20:18:03 +11:00
topecongiro
f45aba9ced Cargo clippy 2017-11-13 08:02:23 +09:00
Nick Cameron
bfa093d394 Fix formatting in git-fmt 2017-11-08 21:10:47 +13:00
Nick Cameron
e8bc2bf966 Tweak the uncommitted file rules for git-fmt 2017-11-08 18:17:12 +13:00
Nick Cameron
aafaa2fc2e Add git-fmt tool 2017-11-08 08:05:44 +13:00
topecongiro
10cb568c18 Remove redundant references 2017-11-06 13:52:25 +09:00
topecongiro
feeca8a724 Remove unnecessary format!() call 2017-11-06 13:52:25 +09:00
topecongiro
b023cc831c Remove static lifetime 2017-11-06 13:52:25 +09:00
topecongiro
fc4a51a242 Prefer println!() to println!("") 2017-11-06 13:52:25 +09:00
topecongiro
79c6f632ef Remove an unnecessary lifetime 2017-11-06 13:52:25 +09:00
topecongiro
b17de6228f Cargo fmt 2017-11-02 21:45:00 +09:00
Seiichi Uchida
fe39c0cd8c Fix a typo 2017-10-30 23:34:44 +09:00
Nick Cameron
cf0d494dda
Merge pull request #1998 from tmahmood/master
Implemented 'unstable options' command line option
2017-10-30 07:50:28 +13:00
topecongiro
5e30a0183f Filter packages only when '-p' was passed 2017-10-29 00:13:37 +09:00
topecongiro
98eb7da0d5 Format dependency crates only when '--all' was passed 2017-10-29 00:12:28 +09:00
Tarin Mahmood
685c9d332f Unstable options added 2017-10-28 16:26:33 +06:00
topecongiro
b0c7201c0e Do not propagate io error when dependencies are not found 2017-10-28 16:40:18 +09:00
topecongiro
d10df70138 Remove iter() in for loop 2017-10-28 01:39:01 +09:00
topecongiro
3b0d2c1426 %s/std::io/io/g 2017-10-28 01:38:28 +09:00
topecongiro
bdcd19d294 Read local dependencies from cargo metadata 2017-10-28 01:38:04 +09:00
topecongiro
8d86b0eaf8 Do not use 'cargo manifest' anymore as it is deprecated 2017-10-28 01:35:32 +09:00
Nick Cameron
73b079d3f6 Merge pull request #2079 from SingingTree/issue-1979-errors-go-to-stdout
Use stderr for various errors and warnings.
2017-10-27 01:02:44 +05:30
Bryce Van Dyk
adac9fb43c Use stderr for various errors and warnings.
Adjusts several error and warning report cases to output using eprintln!
instead of println! so that messages are sent to stderr.
2017-10-25 22:18:19 +13:00
Nick Cameron
9754bcb535 Merge pull request #2048 from japaric/required-version
add `required-version` option to rustfmt.toml
2017-10-20 11:23:27 +05:30