Commit Graph

52 Commits

Author SHA1 Message Date
Nick Cameron
dcf9f61635 Add tests
Closes #2773
Closes #2786
2018-07-24 15:46:39 +12:00
Nick Cameron
4fa2969c39 fixup tests 2018-07-24 15:46:39 +12:00
Stéphane Campinas
f8f9457e20
unecessary use of rustfmt-normalize_comments comment 2018-06-27 15:28:33 +02:00
Nick Cameron
261238ea51 Change use_small_heuristics to an enum and stabilise
Since it is now an enum, we can be future compatible since we can add variants
for different heuristics.

Closes #1974
2018-06-19 13:28:27 +12:00
topecongiro
680c65dc97 Update tests to use the absolute position for small parent heuristic 2018-05-08 06:23:14 +09:00
Seiichi Uchida
48424ea765 Update tests and cargo fmt 2018-03-26 07:38:39 +09:00
Nick Cameron
4f522794ae Tidy up and pass tests 2018-03-02 15:07:13 +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
Seiichi Uchida
b45a69699a Add a test for #2157 2017-12-05 10:02:49 +09:00
topecongiro
4436508712 Fix a test target 2017-11-29 17:29:06 +09:00
topecongiro
4720462e67 Add a test for #2200 2017-11-29 12:34:09 +09:00
Nick Cameron
dd1fbca99a Replace various small width heuristics with a single option
Closes #1984
2017-11-24 20:17:06 +13:00
topecongiro
d2d5ebe4da Add a test for #2126 2017-11-08 08:25:09 +09:00
topecongiro
d287b06eba Rename 'chain_one_line_max' to 'chain_width' 2017-11-04 22:24:43 +09:00
topecongiro
49409c0096 Update tests 2017-11-02 21:38:20 +09:00
topecongiro
8b7defdb19 Add a test for #2067 2017-10-18 22:23:25 +09:00
topecongiro
f8bdcd62e8 Do not allow single-lined closure with block body 2017-09-03 08:10:12 +09:00
topecongiro
68c6fe70fd Format source codes and update tests 2017-07-21 17:57:31 +09:00
Seiichi Uchida
b99f3cb447 Allow extending a chain after raw string literal 2017-06-19 22:06:08 +09:00
Nick Cameron
6f30d9e7c9 Reformat tests 2017-06-13 14:42:54 +12:00
topecongiro
62d200d9cf Update tests 2017-06-04 19:35:29 +09:00
Seiichi Uchida
92270ba191 Add offset when rewriting index 2017-05-25 23:01:41 +09:00
topecongiro
ec33121aaf Format source codes 2017-05-23 22:13:29 +09:00
topecongiro
6d14ac84a4 Update tests 2017-05-03 11:30:17 +09:00
topecongiro
02cf515be6 Format source codes 2017-04-24 16:50:11 +09:00
Nick Cameron
5305bc8436 test fallout 2017-03-28 11:25:59 +13:00
Nick Cameron
a079b87e7c Use a char len heuristic rather than item count for chain_one_line_max 2017-03-28 11:12:15 +13:00
Nick Cameron
91bbe0ff8b Test fallout 2017-03-28 11:01:44 +13:00
Nick Cameron
b9ab3ef9da Test fallout 2017-03-07 11:28:25 +13:00
Nick Cameron
a7612cc773 more fallout 2017-02-23 13:15: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
d3eba76e4d update Serde, etc.
Lots of changes to how closures work
2016-11-21 11:02:18 +13:00
Nick Cameron
0087306761 Merge pull request #1016 from rust-lang-nursery/try-double-indent
Treat chains with just expr? specially.
2016-06-01 12:28:36 +01:00
Marcus Klaas
98c0570a28 Format non-statement if-else expressions on a single line 2016-05-29 17:58:38 +02:00
Nick Cameron
bbb6038b92 Treat chains with just expr? specially.
Fixes #1004
2016-05-29 09:32:48 +01:00
Nick Cameron
d6bcfceb7e Don't put a newline before ? when it is the second sub-expression in a chain (#1012)
Fixes #1003
2016-05-27 10:33:19 +02:00
Marcus Klaas
eae2921e14 Bootstrap it. Hard. 2016-05-12 21:50:43 +02:00
Marcus Klaas
cd158cecc8 Add try macro to try shorthand conversion tests 2016-05-12 21:15:06 +02:00
Marcus Klaas
ee7b5805fc Format try shorthand 2016-05-09 20:07:59 +02:00
Nick Cameron
a9c3108c9c Change defaults and update tests and source
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
2016-04-22 19:18:48 +12:00
Nick Cameron
c7780fdfd8 Be careful about where we change braces in closures
And some general refactoring of closure code.

Fixes #863
2016-04-14 09:05:42 +12:00
Marcus Klaas
c93c771e71 Fix span issue with generic method calls 2015-11-13 14:53:34 +01:00
Marcus Klaas
0bb979bb85 Restore idempotence for chain formatting 2015-10-23 20:37:45 +02:00
Marcus Klaas
2d267b16d1 Deal with floating links in chains 2015-10-22 22:30:01 +02:00
Marcus Klaas
ccd404ac6f Try "overflowing" the final function argument when it's a closure
This means that we try formatting the last argument of a function call with block
indentation instead of visual indentation when it is a closure and its first line
fits on the same line as the first arguments.
2015-10-08 23:40:33 +02:00
Marcus Klaas
7f576b0602 General cleanup after rebase 2015-09-11 00:53:21 +02:00
Marcus Klaas
03c660633f Refine chain breaking heuristics
Don't make a single line chain when it is was multi line in the source; allow overflow of the last chain element onto the next lines without breaking the chain.
2015-09-11 00:53:01 +02:00
Marcus Klaas
a9814149c9 Align dots in chained expressions 2015-09-11 00:53:01 +02:00