Seiichi Uchida
5416c4df76
Modify code around ast::Visibility
...
`ast::Visibility` is changed to `codemap::Spanned` whose node is
`ast::VisibilityKind`. This commit fixes it.
Closes #2398 .
2018-03-06 19:47:28 +09:00
Seiichi Uchida
d316eba54d
Add opt_span_before() to SpanUtils trait
...
With some refactorings to avoid duplicated code.
2018-03-06 19:46:03 +09:00
kngwyu
8ea79aa025
add offset_left(4) for 'dyn '
2018-03-05 22:45:40 +09:00
kngwyu
078fbb0819
support dyn keyword(2506)
2018-03-05 16:57:22 +09:00
Nick Cameron
5025a53b30
Merge pull request #2502 from topecongiro/fix-reorder-module
...
Fix reorder module
2018-03-05 11:20:48 +13:00
Bastien Orivel
64f6372f32
Bump winapi to 0.3
2018-03-02 15:20:26 +01:00
Seiichi Uchida
0bd77f2681
Do not reorder inline modules
2018-03-02 21:53:24 +09:00
Nick Cameron
4f522794ae
Tidy up and pass tests
2018-03-02 15:07:13 +13: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
topecongiro
66b25f1b4a
Create rustfmt_config crate
2018-02-07 22:48:52 +09:00
topecongiro
4af2aa3a9e
Create rustfmt_core crate
2018-02-07 22:48:05 +09:00
Nick Cameron
c9e250a1ab
Merge pull request #2417 from topecongiro/issue-2415
...
Avoid orphan in chain with punctuation
2018-02-06 21:23:14 +13:00
topecongiro
5e0c6f9716
Avoid orphan in chain with punctuation
2018-02-06 09:36:29 +09:00
topecongiro
7f949a5018
Explicitly disable colored output when it is not supported
2018-02-06 09:29:00 +09:00
Seiichi Uchida
d85e1db178
Merge pull request #2393 from RReverser/macro_rules
...
Format stable macro_rules
2018-02-05 09:56:26 +09:00
Nick Cameron
c4314df1ab
Merge pull request #2412 from topecongiro/issue-2399
...
Do not reorder items with '#[macro_use]'
2018-02-05 11:28:58 +13:00
Ingvar Stepanyan
8691c64e99
cargo run cargo-fmt
...
Reformat codebase with current version to pass self_tests (formats macros without repetitions).
2018-02-04 12:09:03 +00:00
Ingvar Stepanyan
d8c154f052
Extract branch rewrite function
2018-02-04 11:55:08 +00:00
Ingvar Stepanyan
571af9d4b1
Format
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
bc9185451d
Move ; between macro branches to a separator
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
6377c52233
Fix comment handling in macros
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
70e7716262
Comments WIP
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
41c393c751
Keep delimiter as part of macro args list
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9423cdba82
Omit newline for empty macro branches
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
5bd036fcac
Optimise common => {{
macro pattern
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
1b9fd01343
Support compact macros 2.0 representation
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9318b4d2cf
Update some macro tests
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
5d973d2e8c
Initial support for macros 1.1
2018-02-04 11:53:09 +00:00
Seiichi Uchida
f815858420
Use correct offset when unindenting code block
...
When using hard tabs, we should only remove '\t'.
2018-02-04 17:21:10 +09:00
Seiichi Uchida
3bb0a2a749
Do not reorder items with '#[macro_use]'
...
Reordering items with `#[macro_use]` could change the semantic of source code.
There could exist other attributes that requires special treatment.
2018-02-04 12:08:02 +09:00
Nick Cameron
346238f497
Merge pull request #2410 from topecongiro/skip-repeat-macro
...
Skip rewriting macro def with repeat
2018-02-04 14:33:03 +13:00
Seiichi Uchida
61b23a4293
Skip rewriting macro def with repeat
2018-02-04 08:52:50 +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
b7f01769f9
Merge branch 'master' into init-shorthand
2018-02-01 15:20:01 +13:00
Nick Cameron
918e79bb5a
Merge pull request #2380 from topecongiro/reorder-mods
...
[RFC] Reorder modules alphabetically
2018-02-01 15:18:34 +13:00
csmoe
28bb16a5a0
add a support for immovable generators
2018-01-30 22:14:33 +08:00
Seiichi Uchida
c9c346a89f
Add 'use_field_init_shorthand' config option
2018-01-29 22:15:20 +09:00
Seiichi Uchida
4c9ab8b405
Cargo fmt with modules reordering enabled
2018-01-29 22:00:07 +09:00
Seiichi Uchida
56c6d73d82
Reorder modules
...
Add `reorder_modules` config option.
Two things we must keep in mind when reordering modules:
1. We should not reorder modules with attributes, as doing so could
potentially break the code (e.g. `#[macro_use]`).
2. We should not reorder inline modules e.g. `mod foo { /* .. */ }`.
We should only reorder module declarations e.g. `mod foo;`.
Some open questions:
1. Should we bring modules with `pub` in front of those without `pub`
so that they stand out from others?
2. Instead of keeping modules with attributes in the same place,
can we bring them in front of others? Is this safe?
2018-01-29 21:59:15 +09:00
Seiichi Uchida
7d63490d85
Update to the latest libsyntax changes
2018-01-29 21:44:26 +09:00
Nick Cameron
4633786848
Merge pull request #2396 from topecongiro/issue-2389
...
Put attributes and enum variants on different lines
2018-01-29 10:36:26 +11:00
Seiichi Uchida
c60d865b98
Put attributes and enum variants on different lines
2018-01-26 16:20:00 +09:00
Seiichi Uchida
dfc67a5df7
Cargo clippy
2018-01-26 14:53:28 +09:00
Seiichi Uchida
f925c581fe
Merge pull request #2386 from acmcarther/master
...
Make rustfmt-bin's CARGO_PKG_VERSION envvar optional
2018-01-26 12:35:52 +09:00
Alex McArther
6d294e6bcb
Make rustfmt-bin's CARGO_PKG_VERSION envvar optional
2018-01-23 07:55:50 -08:00