Seiichi Uchida
3027c21371
Handle raw identifiers
2018-06-25 23:36:45 +09:00
topecongiro
e5e1e0cea8
Fix compile errors from breaking changes in libsyntax
...
cc https://github.com/rust-lang/rust/pull/48149 .
2018-06-25 15:24:00 +09:00
Josh Chase
ee5ff2d9e8
Add flag to the ListFormatting struct for nested imports
2018-06-19 12:13:35 -04:00
Josh Chase
2077855e00
Remove NestedImport tactic
2018-06-19 12:13:26 -04:00
Seiichi Uchida
42ab258757
Put each nested import on its own line
...
while putting non-nested imports on the same line as much as possible.
2018-06-05 19:58:44 +09:00
Shotaro Yamada
d1e2b80fb9
Use saturating_sub
2018-05-15 20:41:43 +09:00
topecongiro
bd25c7d0f7
Cargo fmt
2018-05-08 06:25:48 +09:00
Nick Cameron
bd7ae5e89b
Merge pull request #2682 from topecongiro/issue-2670
...
Do not duplicate attributes on use items
2018-05-07 11:21:02 +12:00
topecongiro
e59ceaf954
Do not duplicate attributes on use items
2018-05-06 17:01:14 +09:00
topecongiro
1f738ea208
Cargo fmt
2018-05-06 15:22:29 +09:00
csmoe
8c8676cd30
fix merge_mix
2018-05-03 10:26:53 +08:00
topecongiro
43df7dcb0e
Run cargo fmt with reorder_impl_items set to true
2018-04-30 16:24:01 +09:00
topecongiro
0c5631e4c1
Use correct span for UseTree
2018-04-28 16:05:02 +09:00
topecongiro
a159b64b0a
Preserve comments between attribute and use item
2018-04-28 16:04:09 +09:00
Seiichi Uchida
ac8ae00625
Cargo update and clippy ( #2643 )
2018-04-25 07:21:23 +09:00
Nick Cameron
55dd8f1df0
Merge pull request #2603 from topecongiro/merge-nested-imports
...
Merge imports
2018-04-12 16:40:06 +12:00
Nick Cameron
1c17dbbf74
rebasing
2018-04-11 10:46:49 +12:00
Nick Cameron
911395a451
Squash the various 'reorder imports' option into one
...
cc #2185
2018-04-11 10:46:49 +12:00
Seiichi Uchida
8820a59bd5
Resolve review comments
2018-04-10 12:36:57 +09:00
Seiichi Uchida
4a7e45ec28
Simplify UseTree::has_comment
2018-04-10 12:36:57 +09:00
Seiichi Uchida
1954513ace
Merge imports with the same prefix into a single nested import
2018-04-10 12:36:57 +09: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