Commit graph

537 commits

Author SHA1 Message Date
Nick Cameron
ed10bf9532 Trailing comma for functions with empty bodies 2017-03-13 11:42:41 +13:00
Nick Cameron
4df405a768 Line breaking around generics in tuple structs 2017-03-13 11:25:46 +13:00
Nick Cameron
4b60d94a99 Check we can put the where clause on one line when we think we can
Fixes #1362
2017-03-10 09:45:26 +13:00
Nick Cameron
70085fca84 Try harder to format function sigs
Fixes #1363
2017-03-10 09:26:14 +13:00
Nick Cameron
e3aad6ee83 Be smarter about finding the span for .. in patterns
Fixes #1319
2017-03-09 15:49:58 +13:00
Nick Cameron
d107ca12b8 Use trailing commas if block formatting fn args
Fixes #1330
2017-03-09 14:47:29 +13:00
Nick Cameron
6025492245 Implement where_style Rfc 2017-03-09 14:21:20 +13:00
Nick Cameron
e7489356c6 Format glob imports
Fixes #1356
2017-03-08 10:12:42 +13:00
Nick Cameron
e5638e0cb5 More space for qself paths
Fixes #1349
2017-03-07 14:53:10 +13:00
Nick Cameron
981b031c9f Treat new blocks like existing ones in closures
Fixes #1355
2017-03-07 14:30:01 +13:00
Nick Cameron
b9ab3ef9da Test fallout 2017-03-07 11:28:25 +13:00
Nick Cameron
33b83ae7df Formatting fallout
Also fixes a minor bug when we break a line after `if` and used to leave a trailing space
2017-03-07 09:50:41 +13:00
Nick Cameron
c9ac348759 Fix failing test 2017-03-02 15:03:32 +13:00
Nick Cameron
f2eac0513f Fix trailing comma tests 2017-03-02 14:27:33 +13:00
Nick Cameron
248f2aba56 Merge branch 'master' of github.com:rust-lang-nursery/rustfmt 2017-03-02 14:27:02 +13:00
Marcus Ball
b8da53ad78 Fix wrap_match_arms resulting in a missing comma (#1307)
* Fix match arms missing comma with "wrap_match_arms = false"

* remove assert; use body_suffix for comma

* basic test case for issue 1127
2017-03-01 09:46:10 +13:00
Nick Cameron
eff665c5c4 Merge pull request #1334 from gypsydave5/fix_1255
Fix #1255 - incorrect removal of `default` on associated types
2017-02-27 11:57:58 +13:00
David Wickes
4f91f02ad1 Test for #1255
Default annotation incorrectly removed on associated type.
2017-02-26 22:27:46 +00:00
Igor Gnatenko
3323056893 bump regex to 0.2
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-02-26 15:09:31 +01:00
Nick Cameron
fbb2370d66 Some tests 2017-02-24 10:43:53 +13:00
Nick Cameron
6a58d91239 Coalesce trailing comma options 2017-02-24 10:31:23 +13:00
Nick Cameron
7ad352239a Fix width bug for long patterns in match arms
Fixes failing test
2017-02-24 07:52:46 +13:00
Nick Cameron
db10a0b9b2 Merge pull request #1325 from C4K3/master
Add error_on_line_overflow option
2017-02-23 14:46:24 +13:00
Nick Cameron
a7612cc773 more fallout 2017-02-23 13:15:48 +13:00
Nick Cameron
ba1202f6b3 test fallout 2017-02-23 13:15:48 +13:00
Sebastian Blunt
235f33b230
Make tests fail if rustfmt encounters an error
Previously tests would not fail if they encountered an error such as
LineOverflow or TrailingWhitespace. Making the tests error out will fix
this mismatch between running rustfmt for real and running the tests.

This also modifies all tests that previously contained errors so that
they no longer contain errors (in almost all of the tests this is
accomplished by setting error_on_line_overflow = false).
2017-02-19 19:57:02 +01:00
sinkuu
fad74c8ac9 Support field-init-shorthand (#1308) 2017-02-13 07:16:11 +13:00
Craig M. Brandenburg
f2c867d067 New disable_all_formatting config option (#1297)
* New `disable_all_formatting` config option

* Resolve code review comments
2017-02-07 17:11:47 +13:00
Trevor Spiteri
6810c762df Handle multiline condition in let if else (fixes #1239) 2017-01-31 23:35:57 +01:00
Nick Cameron
e56ef44a3a Do not format string lits by default 2017-01-27 08:11:59 +13:00
Nick Cameron
1f3100d7bb Make string lit formatting fallible
This allows expressions containing string lits to wrap their content

Fixes #1282
2017-01-27 08:04:52 +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
49e86a1e65 Handle semicolons in macro statements
Fixes #1279
2017-01-18 10:38:46 +13:00
Nick Cameron
0b1d78bae1 Try hard to format impl signatures
Fixes #1249
2017-01-17 13:08:36 +13:00
Nick Cameron
29e8913695 Fix bug in identifying comments
Fixes 1233
2017-01-17 12:01:10 +13:00
Nick Cameron
0218a41d73 Add a more lightweight method for rewriting comments when we are not normalising
Fixes #652
2017-01-17 10:17:48 +13:00
Nick Cameron
d948485371 Allow empty blocks on one line in more places
In particular if they contain only a single-line comment.

Fixes #493
2017-01-16 16:37:58 +13:00
Nick Cameron
846d7ad387 make rustfmt-normalize_comments false by default 2017-01-16 14:50:27 +13:00
Nick Cameron
5349336192 Refactor if/else formatting
Removes else_if_brace_style from config options. Use control_brace_style instead.
2017-01-11 18:14:41 +13:00
Nick Cameron
9be2971274 Refactor pairs/binops 2017-01-11 12:06:23 +13:00
sinkuu
7e2fcc27e1 Fix #1258 (#1266)
* Fix #1258

* Add test
2017-01-09 16:11:12 +13:00
Stepan Koltsov
ad46f9af95 Do not ignore space_before_bound in where clause (#1267) 2017-01-09 15:58:06 +13:00
Nick Cameron
21c085261b Remove self from use foo::bar::self;
Also adds the `normalize_imports` config option.

Fixes #1252
2017-01-06 17:02:56 +13:00
Nick Cameron
6ecf5b8e84 If a string goes over-width, give up formatting it
Logic here is that the original might be better and at best we'll only make it a different kind of bad.

Fixes #1237
2017-01-06 16:35:28 +13:00
Nick Cameron
32cb839855 Macros in types are possible
Fixes #1234
2017-01-06 16:06:09 +13:00
sinkuu
1358f1ac80 Fix #1259 (#1263)
* Use `Indent::block_indent` instead of adding `config.tab_spaces`

* Fix #1259 impl block closing brace placement
2017-01-04 09:20:02 +13: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
Luke Clifton
56469a8745 Don't drop opening brace on long line matches. (#1228)
* Don't drop opening brace on long line matches.

Fixes #1225

* Added a test case for long match arms with braces on newline.
2016-11-28 13:47:38 +13:00
Luke Clifton
6bf1382927 Indent open brace for impl when nested. (#1227)
* Indent open brace for impl when nested.

Fixes #1226

* Added test case for indented impl with brace on newline
2016-11-28 13:47:07 +13:00