Commit graph

10 commits

Author SHA1 Message Date
Nick Cameron
6f30d9e7c9 Reformat tests 2017-06-13 14:42:54 +12: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
Gaëtan Cassiers
9f98f725cb Detect when comments disappear
When the reformatted code doesn't contain the same quantity of comments
as the original code, use the original code instead of the reformatted
code.
This is done for all expressions and `let` statements.

This should be used at the finest grained level possible, to avoid that
a small disappearing comment prevents a big chunk of code to be
reformatted.

Kind of fixes (avoid disappearing comments, but prevents a good
formatting is such case) #285 #225 #563 #743
2016-01-10 15:20:58 +01:00
Kevin Yeh
15ec5b2912 Fix empty body format, add fn_empty_single_line option, refactor block tests 2015-11-19 20:45:02 -06:00
Kevin Yeh
4d7de5a16e Support single-line functions
By default, places functions with empty bodies on one line.
If the function has only one expression or statement that fits on one line, the 'fn_single_line' option can be used.
2015-11-19 14:23:56 -06:00
Eli Friedman
2fff041b43 Pass in whether an ast::Path is in an expression context.
This gets rid of a slightly nasty hack involving scanning the source
expression for a ":".
2015-11-14 13:54:57 -08:00
Marcus Klaas
d05a41c773 Add failure mode to write_list 2015-09-07 20:35:25 +02:00
Marcus Klaas
c3cb348169 Fix qself rewrites without explicit casts 2015-09-06 23:18:27 +02:00
Marcus Klaas
120fd2426e Format assignment 2015-08-25 21:43:13 +02:00
Marcus Klaas
41bca58100 Format paths 2015-08-16 22:53:06 +02:00