690 Commits

Author SHA1 Message Date
cad97
fc1909d311 Reformat 2018-08-23 17:14:19 -04:00
cad97
04d804c365 Rename CodeMap/FileMap to SourceMap/SourceFile
#2946
2018-08-23 17:10:46 -04:00
Seiichi Uchida
024c03e81b Use builder pattern for ListFormatting 2018-08-03 22:13:20 +09:00
Nick Cameron
3c20d8a9e6
Merge pull request #2874 from cavedweller/master
Format Async block and async fn
2018-07-31 08:52:07 +12:00
Ben Brittain
fedde3790c Add tests for async & async move 2018-07-29 08:55:36 -07:00
Ben Brittain
0b25f602fd Format Async block and async fn 2018-07-29 08:05:38 -07:00
Andrew Audibert
f121b1a3a9 Support raw identifiers in struct expressions 2018-07-28 19:40:52 -07:00
Nick Cameron
481e85cc58 formatting 2018-07-24 15:46:39 +12:00
Nick Cameron
f0fe9c3c4a chains: prefer to use the next line for an expression, if using the same line would introduce an open block or similar
This problem came to light due to the chains changes, but effects other code too. It only happens rarely, e.g.,

before this fix:
```
    match foo {
        MacroArgKind::Delimited(ref delim_tok, ref args) => rewrite_delimited_inner(
            delim_tok,
            args,
        ).map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs)),
    };

```

after:
```
    match foo {
        MacroArgKind::Delimited(ref delim_tok, ref args) => {
            rewrite_delimited_inner(delim_tok, args)
                .map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs))
        }
    }

```
2018-07-24 15:43:29 +12:00
Stéphane Campinas
86018133a0
removed unused max_width argument of rewrite_string function 2018-07-14 19:33:26 +02:00
Nick Cameron
486f8fd8e7 Fixup formatting of tests and source 2018-07-12 21:37:28 +12:00
Nick Cameron
a4cdb68925 Improve formatting of series of binop expressions
This commit changes the handling of binops (and potentially other pairs), where
the expressions are logically a list, e.g., `a + b + c`. It makes the single
line vs multi-line approaches explicit and introduces a lowering step.

This improves formatting in a number of places, mostly improving consistency of
formatting with very short sub-expressions, but also some weird indentation.

Closes #2802
2018-07-12 21:37:28 +12:00
Nick Cameron
b68fd9e6bf Move pair handling to its own module 2018-07-12 21:37:28 +12:00
Nick Cameron
b6ea973d19 Factor out PairParts::infix 2018-07-12 21:37:28 +12:00
Seiichi Uchida
60ce411b53 Format async closure 2018-07-09 23:20:53 +09:00
Seiichi Uchida
cc2afeca9e Fix compile errors from breaking changes 2018-06-28 16:26:10 +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
csmoe
c791a54ff4 repair break_label format 2018-06-07 11:21:52 +08:00
Alex Butler
f390626778 Update rustc-ap-* -> 149 (#2748) 2018-05-30 08:22:49 +09:00
Alex Butler
5473c3fd92 Update rustc-ap-* -> 148 2018-05-28 23:41:08 +01:00
Nick Cameron
8674ab9a42 FIXME for <- 2018-05-28 11:15:15 +12:00
Nick Cameron
353816c596
Merge pull request #2730 from topecongiro/issue-2704
Disallow combining a method call with prefix or suffix
2018-05-23 20:10:49 +12:00
topecongiro
fbcc886338 Disallow combining a method call with prefix or suffix 2018-05-23 07:22:42 +09:00
topecongiro
a6b32d944c Fix breaking changes from introducing AnonConst 2018-05-23 06:04:32 +09:00
csmoe
64768cf932 fix label prefix 2018-05-21 22:37:55 +08:00
csmoe
150765d755 format label break 2018-05-21 13:30:07 +08:00
topecongiro
912e4bdc90 Fix breaking changes from rustc-ap-syntax
cc https://github.com/rust-lang/rust/pull/50045.
2018-05-19 08:43:00 +09:00
Nick Cameron
d726492e65 Remove spaces_within_parens_and_brackets
cc #1974
2018-05-18 16:35:09 +12: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
topecongiro
1f738ea208 Cargo fmt 2018-05-06 15:22:29 +09:00
topecongiro
f8439ce8fe Put operands on its own line when each fits in a single line 2018-05-06 15:22:17 +09:00
csmoe
7c246344f8 remove nested parens option 2018-05-05 23:13:49 +08:00
Nick Cameron
e554d8617d
Merge branch 'master' into imports_indent 2018-04-30 11:50:53 +12:00
csmoe
f7415bcea2 update self format 2018-04-29 20:53:31 +08:00
topecongiro
43890cff6b Preserve trailing comma inside array
Closes #2652.
2018-04-28 15:09:54 +09:00
Seiichi Uchida
ac8ae00625
Cargo update and clippy (#2643) 2018-04-25 07:21:23 +09:00
Shotaro Yamada
61d29eb70c Add spaces between consecutive .. ..= 2018-04-16 17:33:22 +09:00
Nick Cameron
1415a4dc23 Fix tests 2018-04-14 10:20:08 +12:00
Nick Cameron
01c1f99e39 Fallout from removing TupField 2018-04-14 10:15:39 +12:00
Nick Cameron
7822d0c921 Fix test 2018-04-09 09:54:07 +12: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
48424ea765 Update tests and cargo fmt 2018-03-26 07:38:39 +09:00
Seiichi Uchida
98c6f7b731 Format array using overflow module
This commit applies heuristics used for function calls to array
and vice versa.
2018-03-26 07:36:44 +09:00
Seiichi Uchida
903de92dae Avoid cloning RewriteContext 2018-03-25 20:20:50 +09:00
Alan Du
d402cd20a8 Close #2551 2018-03-22 00:57:22 -04:00
Nick Cameron
0bc0241d2a
Merge pull request #2548 from topecongiro/match-mod
Do not collapse block around expr with condition on match arm
2018-03-22 15:40:36 +13:00
Seiichi Uchida
88589f2ad8 Add matches module
`matches` module contains `rewrite_match` and related stuffs.
2018-03-21 22:21:08 +09:00