Commit Graph

351 Commits

Author SHA1 Message Date
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
Nick Cameron
dd807e2465 Update rustc_ap_syntax 2018-04-18 08:19:57 +12:00
csmoe
cef31b2841 update rustc-ap-syntax (#2622)
* update rustc-ap-syntax-100.0.0
2018-04-15 18:49:47 +09:00
Nick Cameron
aa7fc4cdc5 Update rustc-ap-syntax 2018-04-14 09:47:13 +12:00
Nick Cameron
84598bd990 Update rustc_ap_syntax 2018-04-13 10:34:23 +12:00
Nick Cameron
febbb36937 nightly-0.4.2 2018-04-12 17:06:30 +12:00
Seiichi Uchida
0a2f01483b Cargo update 2018-04-12 12:48:27 +09:00
csmoe
84d3659767 update rustc syntax 91.0.0 2018-04-08 22:22:11 +08:00
Seiichi Uchida
edcc7b69eb
Cargo update (#2602)
Update `rustc-ap-syntax` to 89.0.0 and fix up breaking changes.
2018-04-06 23:09:45 +09:00
Seiichi Uchida
73e7235317
Cargo update (#2575)
Update `rustc-ap-syntax` to 82.0.0.
2018-03-30 17:52:09 +09:00
topecongiro
32ab7f4967 Cargo update
Update rustc-ap-syntax to 73.0.0.
2018-03-22 15:53:08 +09:00
topecongiro
87180d9065 0.4.1 2018-03-16 08:58:25 +09:00
topecongiro
a03b3b7d6f Cargo update
Remove `rustc-ap-rustc_errors` from dependencies since it
is re-exported from `rustc-ap-syntax`.
2018-03-16 08:52:36 +09:00
Seiichi Uchida
a353294fe4 Cargo update
Update `rustc-ap-syntax` to `67.0.0`.
2018-03-15 18:55:31 +09:00
Nick Cameron
bcaeab7a5e
Merge pull request #2527 from topecongiro/issue-2526
Check whether '\\'' is char literal or lifetime
2018-03-12 11:25:40 +13:00
Seiichi Uchida
86a427fe32 Check whether '\\'' is char literal or lifetime 2018-03-10 01:19:38 +09:00
Bastien Orivel
a1dd6bd930 Dedupe syn/quote 2018-03-09 16:12:22 +01:00
Seiichi Uchida
a6b574bfa7 Cargo update and cargo clippy 2018-03-08 18:10:23 +09:00
Seiichi Uchida
64d838490a Cargo update
Bump `rustc-ap-syntax` and `rustc-ap-rustc_errors` to `57.0.0`.
2018-03-06 19:45:17 +09:00
Bastien Orivel
64f6372f32 Bump winapi to 0.3 2018-03-02 15:20:26 +01:00
Bastien Orivel
5f4eb0f17e Bump log to 0.4 and env_logger to 0.5 2018-03-02 13:08:23 +01: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
Nick Cameron
6154f2b3e5 Fix build 2018-03-02 14:25:26 +13:00
Nick Cameron
ab7b4a8bf5 Revert "Remove rustfmt and cargo-fmt"
This reverts commit 9d2229f2fd.

And `cargo updates`
2018-03-02 14:12:33 +13:00
Alex Crichton
2ed8baf934 Update env_logger to 0.5
Helps unify with some dependencies in rust-lang/rust!
2018-03-01 10:31:57 -08:00
Nick Cameron
9d2229f2fd Remove rustfmt and cargo-fmt
Moved them to the rustfmt-bin repo
2018-02-26 16:53:31 +13:00
topecongiro
5bd456dc3e Cargo update 2018-02-07 22:51:14 +09:00
Nick Cameron
30a28a262c Make is_mod_decl more accommodating
Fixes #2403 (I think)
2018-02-02 15:16:29 +13:00
Nick Cameron
7c3a422742 Update libsyntax crates 2018-02-02 14:18:30 +13:00
Nick Cameron
2a71bef0b0 0.3.7 2018-02-01 19:25:48 +13:00
Seiichi Uchida
5977f516b1 Cargo update 2018-01-29 21:43:44 +09:00
Seiichi Uchida
e0e3e22248 0.3.6 2018-01-18 18:56:46 +09:00
Seiichi Uchida
fa782303a6 0.3.5 2018-01-15 21:34:41 +09:00
Nick Cameron
3e29fe3330 Use published versions of libsyntax and librustc_errors
Rather than the versions shipping with the compiler. These are still unstable,
so nightly is still required, but we can control when we update so breakage should
happen less often.
2018-01-11 18:21:35 +13:00
David Alber
85ccb98469 Adding test to verify code block idempotency in Configurations.md 2018-01-04 00:01:18 -08:00
Marcus Klaas
656edbf0f0 Use std time 2017-12-27 16:34:09 +13:00
Marcus Klaas
dc356ffef7 Add rudimentary timing of parsing and formatting phases 2017-12-27 16:33:21 +13:00
Seiichi Uchida
6714a447d0 0.3.4 2017-12-23 12:25:42 +09:00
Nick Cameron
c537f2de11 0.3.3 2017-12-22 16:14:05 +13:00
topecongiro
c0701f5fa5 0.3.2 2017-12-15 10:39:33 +09:00
Seiichi Uchida
6ce082e3f1 0.3.1 2017-12-11 22:09:48 +09:00
Seiichi Uchida
414a995926 Replace StringBuffer with String 2017-12-11 09:19:00 +09:00
Nick Cameron
3f7a27b547 0.3.0 2017-12-11 09:35:30 +13:00
Nick Cameron
632ea1afdf 0.2.17 2017-12-03 13:39:20 +13:00
Seiichi Uchida
426ba1cdab Cargo update 2017-11-28 17:35:52 +09:00
topecongiro
1b1122654f Add cargo_metadata to dependency 2017-11-27 18:37:21 +09:00
Nick Cameron
d0f12b8ec8 Remove unused option take_source_hints 2017-11-24 13:08:02 +13:00
Nick Cameron
1952459278 0.2.16 2017-11-21 09:43:33 +13:00
Utkarsh Kukreti
02c024932c Fix missing trailing newline in --write-mode=diff.
This was a bug in the `diff` crate which has been fixed in 0.1.11. This PR
simply bumps `diff` to that version.

Fixes #1753.

    $ xxd main.rs
    00000000: 666e 206d 6169 6e28 2920 7b7d            fn main() {}
    $ cargo run --bin rustfmt -- main.rs --write-mode=diff
    $ echo $?
    0
    $ git checkout issue-1753
    Switched to branch 'issue-1753'
    $ cargo run --bin rustfmt -- main.rs --write-mode=diff
    Diff in /Users/utkarsh/dev/git/rustfmt/main.rs at line 1:
     fn main() {}⏎
    +⏎
    $ echo $?
    4
2017-11-17 08:50:00 +05:30
Nick Cameron
4d2ed86611 nightly-0.2.15 2017-11-08 08:07:31 +13:00
topecongiro
1cd26db8c4 Add derive-new to dependencies 2017-11-06 21:43:17 +09:00
topecongiro
51b03c3aaf nightly-0.2.14 2017-11-06 00:55:10 +09:00
topecongiro
0509f337cb Cargo update 2017-11-06 00:55:04 +09:00
Nick Cameron
c6d4351f1c nightly-0.2.13 2017-10-30 07:42:45 +13:00
topecongiro
485ef93e49 nightly-0.2.12 2017-10-29 00:23:02 +09:00
topecongiro
ee490aea00 nightly-0.2.11 2017-10-28 18:53:39 +09:00
Nick Cameron
b22643a572 0.2.10 + cargo update 2017-10-28 18:45:56 +13:00
Nick Cameron
5233f9cde0 Add support for crate shorthand for pub(crate) 2017-10-28 18:41:58 +13:00
Seiichi Uchida
40e6c26b8b nightly-0.2.9 2017-10-16 12:24:18 +09:00
Seiichi Uchida
474c1935d6 Cargo update 2017-10-16 12:24:15 +09:00
topecongiro
45146e16ee nightly-0.2.8 2017-09-28 18:11:23 +09:00
topecongiro
bfac2755d4 Cargo update 2017-09-28 18:11:18 +09:00
Nick Cameron
02d8067f14 nightly-0.2.7 2017-09-21 10:50:45 +12:00
topecongiro
ed2687f33b Cargo update 2017-09-15 17:05:27 +09:00
Nick Cameron
7e309a4ad8 nightly-0.2.6 2017-09-14 16:06:36 +12:00
Nick Cameron
8122f0b083 nightly-0.2.5
And cargo update
2017-08-31 14:32:54 +12:00
Nick Cameron
e780532239 nightly-0.2.4 2017-08-30 13:56:08 +12:00
Nick Cameron
897b224b54 nightly-0.2.3 2017-08-30 12:26:27 +12:00
Seiichi Uchida
98f737c708 Cargo update 2017-08-28 23:39:56 +09:00
Nick Cameron
bc9c65a2ac 0.2.2 2017-08-22 13:09:13 +12:00
topecongiro
a763f3b75b Cargo update 2017-08-11 17:54:54 +09:00
Nick Cameron
cb351440e9 cargo update 2017-07-25 15:57:56 +12:00
Nick Cameron
6984c05e69 Change the writemode to overwrite 2017-07-21 11:22:51 +12:00
Nick Cameron
ed90489871 cargo update 2017-07-10 16:18:41 +12:00
Nick Cameron
818ff7a602 nightly-0.1.8 2017-07-05 15:59:24 +12:00
Nick Cameron
f028cbe760 nightly-0.1.7 2017-06-23 17:03:47 +12:00
Nick Cameron
c9d53e13d7 nightly-0.1.6 2017-06-23 16:30:19 +12:00
Nick Cameron
fbc95385d3 nightly-0.1.5 2017-06-20 17:00:01 +12:00
Nick Cameron
cd6092ebf9 nightly-0.1.4 2017-06-19 13:22:42 +12:00
Nick Cameron
34fa428471 make file_lines::Range public 2017-06-19 12:58:29 +12:00
Nick Cameron
562d218ce9 Update README for running the nightly version 2017-06-16 12:00:43 +12:00
Nick Cameron
5f1bab26c4 Move to Libsyntax 2017-06-14 14:01:56 +12:00
Nick Cameron
1f512948a0 Reformat source code using new defaults 2017-06-13 14:41:49 +12:00
Nick Cameron
67e26970c3 v0.8.5 + cargo update 2017-06-12 15:44:56 +12:00
est31
727963afe4 Update syntex_syntax
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
Nick Cameron
a7b8dcc60d Simplify --version info 2017-05-25 16:39:44 +12:00
Nick Cameron
393ba27311 Remove dependency on Itertools 2017-05-25 16:23:07 +12:00
Nick Cameron
80f3b3c9c4 Remove multimap dep 2017-05-25 15:59:06 +12:00
Nick Cameron
219822ba3f Bump version of strings.rs and cargo update 2017-05-18 07:59:09 +12:00
Nick Cameron
18070f4041 bump version (0.8.4) and cargo update 2017-05-10 10:43:34 +12:00
est31
78d4ef1992 Drop rustc-serialize, use serde, update toml dependency 2017-05-03 10:23:50 +02:00
Nick Cameron
89f6aa2996 cargo update 2017-05-03 18:02:48 +12:00
Sheng Hau
0653b8413e Show exit codes' meanings with the rustfmt help message 2017-04-19 00:25:48 +08:00
Nick Cameron
fa732ede8b v0.8.2 2017-04-06 21:22:29 +12:00
Nick Cameron
7377dfc38c release v8.1 2017-03-28 13:19:59 +13:00
Nick Cameron
4ed5a3bac7 Bump version to 0.8 and cargo update 2017-03-08 10:18:10 +13:00
Nick Cameron
c9ac348759 Fix failing test 2017-03-02 15:03:32 +13:00
Nick Cameron
2261947f6e Catch attributes before comments
Closes #1280
Closes #1284
2017-01-26 15:10:47 +13:00
Nick Cameron
6572874965 Update to latest Syntex
As a side-effect of the Path changes, we are now a bit more aggressive about normalising paths.
2017-01-20 08:20:49 +13:00
Nick Cameron
923423fa32 v0.7.0 and cargo update 2017-01-17 13:12:08 +13:00
Nick Cameron
32cb839855 Macros in types are possible
Fixes #1234
2017-01-06 16:06:09 +13:00
Erick Tryzelaar
836682eef4 Version bump for toml, unicode-segmentation, itertools, and walkdir 2016-12-23 11:26:23 -08:00
Erick Tryzelaar
e67ffcfb21 Update to the latest syntex module
One notable feature is this this adds support for the experimental
`let x = loop { ... break $expr; }` syntax. This also includes a
test for formatting all the break and continue variations.
2016-12-23 11:20:07 -08:00
Nick Cameron
d3eba76e4d update Serde, etc.
Lots of changes to how closures work
2016-11-21 11:02:18 +13:00
Nick Cameron
61ab06a92e v0.6.3 2016-11-20 10:37:34 +13:00
Nick Cameron
f1df5c1aa9 cargo update 2016-10-07 12:58:18 +13:00
Nick Cameron
4418fab4f2 Update to latest Syntex
+ Cargo update
+ 0.6.2 release
2016-09-16 15:28:02 +12:00
Nick Cameron
d022f05f34 v0.6.0 2016-08-11 10:08:59 +12:00
Nick Cameron
ddda46d265 rustup 2016-07-04 15:46:58 +12:00
Kamal Marhubi
5361f61110 Include git commit and worktree status in version output (#1060)
This will help in debugging issues as rustfmt gets more users.

If the working tree is clean, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (9f5ed3b)

If the working tree is dirty, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (9f5ed3b worktree dirty)

If git is unavailable, output looks like

    $ target/debug/rustfmt -V
    0.5.0 (git commit unavailable)

To avoid rebuilds on changing tests, the build script will only rerun if
files under src/ are changed. This means the actual git status may show
changed files and this would not show up in the version. This should not
be an issue as files not in src/ should not affect the build output.
2016-06-12 10:38:03 +02:00
Kamal Marhubi
9759068e62 print_diff: Don't print color codes if output is not a tty
On unix, `term::stdout()` just reads the `TERM` environment variable to
decide what features are available. It does not check if the output file
descriptor is in fact a tty. This resulted in printing escape codes when
redirecting output.
2016-05-31 15:15:33 +02:00
Kamal Marhubi
c311b30cac Add type to represent collection of lines in files
This commit adds a type to represent lines in files, and adds it to the
`Config` struct. It will be used for restricting formatting to specific
lines.

Refs #434
2016-05-31 01:24:38 +02:00
Kamal Marhubi
120e1a0b51 deps: Update syntex_syntax to 0.33
This bump brings syntex_syntax support for `..` in tuple and tuple
struct patterns, which come from RFC 1492:
  https://github.com/rust-lang/rfcs/blob/master/text/1492-dotdot-in-patterns.md

These new patterns are not properly handled in this PR; instead #1021
tracks supporting them.

Refs #1021
2016-05-30 14:53:04 +02:00
Kamal Marhubi
66cac1f3e9 Handle pub(restricted) (#1013)
* Handle pub(restricted)

This commit properly handles pub(restricted) as introduced in RFC 1422
[0]. The syntax support was added in #971, but they were not correctly
formatted.

[0] https://github.com/rust-lang/rfcs/blob/master/text/1422-pub-restricted.md

Fixes #970

* Drop #[inline] attribute on format_visibility

* Make newly non-failing functions return String

The change to `format_visibiilty` means that `format_header` and
`format_unit_struct` can no longer fail. Their return type is updated to
reflect that.
2016-05-28 00:58:25 +02:00
Nick Cameron
0fae34dfa1 Don't ignore universal quantification in function types
Fixes #1006
2016-05-27 15:09:04 -07:00
Nick Cameron
9b05461666 Write each file as it is formatted (#991)
The old behaviour stored everything in memory until we were finished. Now we write as soon as we can.

This gives better behaviour when formatting large programs, since there is some progress indication. It also opens the door to optimising memory use by not storing everything in memory unless it is required (which it still might be). That is left as future work though.
2016-05-15 11:41:05 +02:00
Kamal Marhubi
8309d1a74c deps: Update syntex_syntax to 0.32.0 2016-05-05 16:39:34 -04:00
Kamal Marhubi
fd38acb86f deps: Update syntex_syntax to 0.31.0
Most of the churn on this bump comes from the `Visibility` enum changing
from

    pub enum Visibility {
        Public,
        Inherited,
    }

to

    pub enum Visibility {
        Public,
        Crate,
        Restricted { path: P<Path>, id: NodeId },
        Inherited,
    }

which require taking `Visibility` by reference in most places. The new
variants are not handled at this point.

Refs #970
2016-05-01 23:06:58 -04:00
Nick Cameron
19849fea15 Update the world 2016-04-08 15:51:06 +12:00
Nick Cameron
5b11d2e80f Merge pull request #892 from marcusklaas/closed-ranges
Format closed ranges
2016-03-31 13:47:09 +13:00
Nick Cameron
19768da5c9 Version bump - v0.4
closes #870
2016-03-30 15:19:46 +13:00
Marcus Klaas
9eee93306a Format closed ranges 2016-03-29 23:58:45 +02:00
Kamal Marhubi
f2b5931c6d deps: Update syntex_syntax to 0.30.0
This bump includes ability to parse inclusive ranges (`a...b`) and the
question mark operator.

Refs #867, #890
2016-03-29 00:04:44 -04:00
Marcus Klaas
03bf1ceeb9 Fix tuple destructuring in impl fns 2016-03-27 13:07:28 +02:00
Nick Cameron
204e732c1b cargo update 2016-03-14 18:19:57 +13:00
Kamal Marhubi
589dabda2f deps: Update syntex_syntax to 0.29.1 2016-03-02 13:08:21 -05:00
Manish Goregaokar
23ba7e7b4b Upgrade deps to make it compile again 2016-02-27 00:58:31 +05:30
Kamal Marhubi
09425ddc35 Bump version in Cargo.lock
This was missed in 82a177e.

Refs #805
2016-02-10 13:15:01 -05:00
Utkarsh Kukreti
6a12818c23 Bump diff to 0.1.8. Fixes #606. 2015-12-28 17:22:03 +05:30
Aleksey Kladov
b3f691fa13 update Cargo.lock to match Cargo.toml 2015-12-23 17:31:54 +03:00
Nick Cameron
909b3560ba Add quick start info to README.md, cargo update. 2015-12-16 17:58:20 +13:00
Nick Cameron
78957d371e Use crates.io for everything 2015-12-14 08:03:58 +13:00
Nick Cameron
e94bd34a06 cargo upgrade, bug fix, and prepare for packaging 2015-12-08 16:19:23 +13:00
Jakko Sikkar
411fa40988 update dependencies and fix compile errors 2015-11-23 20:54:33 +02:00
Nick Cameron
56a765ef05 Rustup 2015-11-16 14:16:46 +13:00
Alex Crichton
26958a1c10 Move option parsing to crates.io-based getopts crate
Should help adding more options in the future as well!
2015-10-23 13:46:14 -07:00
Alex Crichton
579fb34417 Remove dependence on rustc/rustc_driver, use syntex
Instead just parse manually with the `syntex_syntax` crate which is a clone of
libsyntax on crates.io which builds on stable Rust.
2015-10-23 13:46:14 -07:00
Alex Crichton
cda463275e Use the log/env_logger crates from crates.io 2015-10-23 13:46:14 -07:00
Marcus Klaas
e8447a8210 Fix large block comments 2015-10-19 23:06:36 +02:00
Marcus Klaas
199d40fa55 Increase default function call width limit 2015-10-06 22:27:11 +02:00
Marcus Klaas
da3d2f57da Bump diff.rs version
This should make the computation of diffs quite a bit faster, which is particularly noticable in tests.
2015-09-14 20:22:07 +02:00
Sinh Pham
e7a5f9327e Add diff write mode https://github.com/nrc/rustfmt/issues/261 2015-09-10 18:30:07 -04:00
Sinh Pham
61f642f6f8 Support unicode in string literals. 2015-09-03 23:41:25 -04:00
Marcus Klaas
adeafb3e45 Refactor diff handling in tests
This splits the generation and display of mismatches. Mismatches now include a few lines of context. Finally, diffs are now coloured.
2015-08-30 22:31:26 +02:00
Gaëtan Cassiers
5b5927996f Kill ChangeSet and replace remaining part by FileMap
Also fix style issues
Cargo update to get fixes of strings.rs (was cause of a misformatted
function call).
2015-08-02 13:33:01 +02:00
Marcus Klaas
5924b83829 Rustup 2015-06-22 14:52:23 +02:00
Marcus Klaas
98c9c6e9ef implement framework for system tests 2015-06-05 17:50:22 +02:00
Nick Cameron
1a09a6d00a Use config file for constants 2015-05-23 17:53:53 +12:00
Nick Cameron
aa6f7e8d3c Add default.toml and modify the build system for it 2015-05-23 15:28:41 +12:00
Marcus Klaas
4ecde410c4 Show diffs for failing tests 2015-05-12 02:19:14 +02:00
Tobias Bucher
7d70c9b02d Add Cargo.lock file, because this application is a program
Do this so you can reliably build `rustfmt` in the future, even if one of the
dependencies (in this case, only `strings.rs`) makes backward-incompatible
changes.

See also http://doc.crates.io/guide.html#cargo.toml-vs-cargo.lock.
2015-04-30 09:33:13 +02:00