Nick Cameron
911395a451
Squash the various 'reorder imports' option into one
...
cc #2185
2018-04-11 10:46:49 +12:00
Nick Cameron
e784712f09
Try to fix a build regression before it happens
2018-04-09 21:07:49 +12:00
csmoe
84d3659767
update rustc syntax 91.0.0
2018-04-08 22:22:11 +08:00
Seiichi Uchida
04227a7d30
Fix up merge mess
2018-04-06 10:31:57 +09:00
Nick Cameron
4b2160e1b2
Merge pull request #2599 from topecongiro/issue-2596
...
Use multiple lines for imports list which exceeds max width
2018-04-06 11:12:53 +12:00
Seiichi Uchida
636de8313d
Put imports list on the next line if it exceeds max width
2018-04-05 13:24:18 +09:00
Seiichi Uchida
01311c63ec
Format normalized use item
...
This commit implements `Rewrite` trait on `UseTree`, which is a normalized
form of `ast::UseTree` for rustfmt.
2018-03-31 14:23:36 +09:00
topecongiro
846f4f21db
Fix libsyntax updates
...
`ast::UseTreeKind::Simple` now takes `Option<ast::Ident>`
instead of `ast::Ident`.
2018-03-22 15:55:14 +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
4af2aa3a9e
Create rustfmt_core crate
2018-02-07 22:48:05 +09:00
topecongiro
5e0c6f9716
Avoid orphan in chain with punctuation
2018-02-06 09:36:29 +09:00
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand
2018-02-01 15:20:01 +13: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
154bf8e1af
Cargo fmt
2018-01-22 13:05:18 +09:00
Seiichi Uchida
949708f617
Use correct BytePos when recovering comments on removed import
2018-01-10 21:30:41 +09:00
topecongiro
75cb236711
Compare extern crate items with its name instead of span
...
When we use span, bugs easily sneak in.
2018-01-04 12:49:37 +09:00
Seiichi Uchida
1ef6bccea3
Cargo fmt
...
Run 'cargo fmt' with the following setting:
```
reorder_imports = true
reorder_imports_in_group = true
```
2017-12-24 00:28:58 +09:00
Seiichi Uchida
516f15aba1
Cargo clippy
2017-12-12 13:48:12 +09:00
Nick Cameron
d2b006d6b4
Merge pull request #2255 from topecongiro/nested-imports
...
Nested imports
2017-12-11 08:53:23 +13:00
Seiichi Uchida
234c7da871
Handle nested imports
2017-12-09 16:45:25 +09:00
topecongiro
5e6bb3edb0
Keep track of line number in visitor
2017-12-08 16:59:04 +09:00
Seiichi Uchida
3ebe054362
Replace into() on &str with to_owned()
2017-12-08 13:07:42 +09:00
Seiichi Uchida
89f27764ed
Cargo fmt and update tests
2017-12-02 17:45:39 +09:00
Pietro Albini
9d8cfbcd93
Fix imports formatting broken after AST change
2017-12-01 00:18:00 +01:00
topecongiro
35466adbfe
Generalize ListItems to allow a separator other than comma
2017-11-16 17:43:36 +09:00
topecongiro
34c2499029
Cargo fmt
2017-11-16 17:43:06 +09:00
topecongiro
d66161c6a3
Prefer &[T] to &Vec<T>
2017-11-06 13:52:25 +09:00
topecongiro
6c5ac5a9b3
Remove needless borrows
2017-11-06 13:52:25 +09:00
topecongiro
314c97387d
Squash redundant match arms
2017-11-06 13:52:25 +09:00
topecongiro
fe69dde96b
Replace 'try_opt!' macro with a '?' operator
2017-10-05 20:50:19 +09:00
Seiichi Uchida
32fa51a6a9
Move Spanned to spanned.rs from lib.rs
2017-09-19 10:04:35 +09:00
Seiichi Uchida
df7d2be562
Move Indent and Shape to shape.rs from lib.rs
2017-09-19 10:04:35 +09:00
Nick Cameron
d906ea23c7
Merge pull request #1968 from topecongiro/issue-1967
...
Reorder use items inside blocks
2017-09-18 12:59:25 +12:00
Seiichi Uchida
178a339fc3
Reorder use items inside blocks
2017-09-15 22:31:52 +09:00
topecongiro
f51261e93e
Cargo fmt
2017-09-15 12:10:58 +09:00
topecongiro
662ee46e67
Use write_list() to format imports
2017-09-06 18:47:50 +09:00
Seiichi Uchida
4b79055a15
Apply refactoring from cargo clippy
2017-08-31 12:49:12 +09:00
Vadim Petrochenkov
6e5c6f5ba3
Use getters to access Span
fields
2017-08-31 14:14:13 +12:00
topecongiro
e31a48b4d9
Refactoring: remove duplicates
2017-08-30 19:26:45 +09:00
Seiichi Uchida
63ac49638b
Support match_pattern_separator_break_point config option
2017-08-18 23:19:47 +09:00
Nick Cameron
62689ef568
Merge pull request #1861 from topecongiro/refactor-chain
...
Remove unnecessary rewriting
2017-08-10 09:03:45 +12:00
topecongiro
be38606c77
Add leave_last field to ListItems
2017-08-09 16:37:21 +09:00
topecongiro
7bf9aa25be
Add reorder_extern_crates and reorder_extern_crates_in_group config options
2017-08-09 00:16:18 +09:00
Caleb Jones
94df4f8cca
Move the empty path_list handling into rewrite_use_list()
2017-08-06 23:04:33 -04:00
Caleb Jones
fa242a5cd6
Fix #1858 - "Don't erase a use with attributes attached"
...
This prevents code like
#[cfg(unix)]
pub use self::unix::{};
from becoming
#[cfg(unix)]
which would cause the attribute to be attached to the next item.
2017-08-06 19:53:57 -04:00
Seiichi Uchida
e588f2fd7b
Make definitive_tactic more generic via enum Separator
2017-07-31 16:23:42 +09:00
Seiichi Uchida
570a3505b9
Make definitive_tactic more generic with separator length
2017-07-29 22:13:23 +09:00
Nick Cameron
1f991d00e0
Merge pull request #1822 from topecongiro/issue-1172
...
Remove newlines between list elements for expressions
2017-07-27 11:15:53 +12:00
Seiichi Uchida
261865ecc9
Remove newlines between list elements for expressions
2017-07-26 22:43:36 +09:00
topecongiro
38614e7af1
Format source codes and update tests
2017-07-26 17:43:17 +09:00