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
Seo Sanghyeon
16b348dd9c
Add commas after skipped arms when needed
2016-01-08 22:15:54 +09:00
Seo Sanghyeon
f9f7235c1b
Trailing commas for wildcard arms
2016-01-06 11:02:01 +09:00
Marcus Klaas
291aa1b228
Make fn argument formatting more resilient for complex self types
2015-12-27 14:25:37 +01:00
Nick Cameron
71508b310b
Merge pull request #728 from marcusklaas/typed-mut-self
...
format typed mut self
2015-12-27 09:18:20 +13:00
Marcus Klaas
954dd0869e
Preserve mutability for typed self arguments
2015-12-25 19:07:51 +01:00
Marcus Klaas
1e80fd2dcd
Prevent incorrect backslash removal in strings
2015-12-25 18:50:40 +01:00
Aleksey Kladov
e3123ce88c
test ignored out of line modules
...
tests #719
2015-12-24 00:15:29 +03:00
Marcus Klaas
8cccf45d43
Prevent backslash stripping in string literals
2015-12-12 16:25:01 +01:00
Nick Cameron
f8cb1baadd
Add normalise_comments option.
...
So block comments are not converted to line comments
2015-12-10 09:29:03 +13:00
Nick Cameron
585b071aa1
Merge pull request #678 from marcusklaas/length-one-tuplez
...
Fixed named arguments in bare function types
2015-12-07 09:01:38 +13:00
Nick Cameron
db72e0390c
Merge pull request #664 from marcusklaas/fix-reformat-failurez
...
Don't include failed item rewrites in missed spans
2015-12-07 08:33:02 +13:00
Nick Cameron
397449b292
Merge pull request #668 from marcusklaas/regression-tests
...
Regression tests
2015-12-07 08:10:06 +13:00
Nick Cameron
f569144bbf
Merge pull request #666 from marcusklaas/matches-5000
...
Break function headers earlier
2015-12-07 08:07:23 +13:00
Marcus Klaas
97e4e7e5ba
Fixed named arguments in bare function types
2015-12-06 01:11:26 +01:00
Marcus Klaas
ea6ce22a16
Add regression test for overlong trait methods
2015-12-02 21:08:09 +01:00
Marcus Klaas
9734bd05af
Add regression test for backslash stripping
2015-12-02 21:03:41 +01:00
Markus Westerlind
a6b0d475f4
Don't remove where clauses in type aliases
2015-12-02 20:11:17 +01:00
Markus Westerlind
ae9ad7b288
Fix formatting of type aliases where '=' is at or close to the max width
2015-12-02 20:11:10 +01:00
Marcus Klaas de Vries
e677f05805
Merge pull request #659 from Marwes/where_clause
...
Fix where clauses not taking the width of the line into account
2015-12-02 19:06:24 +01:00
Marcus Klaas
76f303f369
Break function headers earlier
...
Closes rustfmt#295.
2015-12-01 22:09:37 +01:00
Bryce Van Dyk
7ce887abcf
Update trailing comma match logic, add tests
...
Updates the traling comma code to attempt to handle multiline non-block bodies when
adding traling commas to blocks. Also add and update tests to cover better
the interactions between trailing commas and wrapping match arms.
2015-12-01 20:10:57 +13:00
Marcus Klaas
0fb9611786
Don't include failed item rewrites in missed spans
2015-11-30 23:12:50 +01:00
Bryce Van Dyk
2a430a8947
Trailing commas for match block arms
...
Attempt to implement an option for trailing commas for block based match arms (issue
173). Put in place test files to verify this behaviour.
2015-11-30 21:51:20 +13:00
Markus Westerlind
937467c358
Fix where clauses not taking the width of the line into account
...
Fixes #630
2015-11-27 09:27:41 +01:00
Markus Westerlind
c61d6d4c3a
Format type aliases
...
Fixes #486
2015-11-26 21:04:49 +01:00
Kevin Yeh
f5fac4c54f
Fix empty trim_newline panic, add impl macro test
2015-11-24 14:37:31 -06:00
Kevin Yeh
c408245e5d
Add impl newline tests
2015-11-24 13:02:55 -06:00
Nick Cameron
d405fdc236
Fix a bug with nested impls
2015-11-24 09:37:52 +13:00
Marcus Klaas de Vries
5a3f5bc1f6
Merge pull request #646 from rust-lang-nursery/mulit-file
...
Handle multiply-referenced files
2015-11-23 21:35:09 +01:00
Nick Cameron
40eb3ea857
Merge pull request #641 from marcusklaas/fix-doc-commentz
...
Correct doc comment indentation for struct fields
2015-11-23 13:58:19 +13:00
Nick Cameron
e86872c95b
tests
2015-11-23 13:09:00 +13:00
Marcus Klaas
4b4dd170d8
Correct doc comment indentation for struct fields
...
Fix https://github.com/rust-lang-nursery/rustfmt/issues/572 .
2015-11-22 22:55:57 +01:00
Nick Cameron
ba936766c6
Take rustfmt_skip attribute into account on modules
...
Closes #632
2015-11-23 09:20:53 +13:00
Nick Cameron
b9832f2e9f
Merge pull request #638 from marcusklaas/visual-struct-last-comment
...
Fix last comment for visually formatted struct lits
2015-11-23 07:23:58 +13:00
Marcus Klaas
2b0a25a539
Fix last comment for visually formatted struct lits
2015-11-22 17:41:54 +01:00
Marcus Klaas
840012b5e0
Format bare function types
...
Fix https://github.com/rust-lang-nursery/rustfmt/issues/616 .
Fix https://github.com/rust-lang-nursery/rustfmt/issues/276 .
Close https://github.com/rust-lang-nursery/rustfmt/issues/350 .
2015-11-22 16:07:38 +01:00
Marcus Klaas
559f00ba99
Fix up indentation of function style paths
...
Fixes https://github.com/rust-lang-nursery/rustfmt/issues/105 .
2015-11-22 14:48:30 +01:00
Marcus Klaas de Vries
a871405f45
Merge pull request #633 from marcusklaas/mod-comment
...
Rewrite module declarations
2015-11-21 21:24:29 +01:00
Marcus Klaas
49e2a146b1
Rewrite module declarations
2015-11-21 21:06:29 +01:00
Marcus Klaas de Vries
2a159e05ac
Merge pull request #635 from Marwes/long_field_access
...
Fix long field accesses not being broken onto separate lines
2015-11-21 21:04:34 +01:00
Markus Westerlind
465662a691
Fix long field accesses not being broken onto separate lines
...
Fixes #512
2015-11-21 01:05:31 +01:00
Nick Cameron
7809e3bb18
Merge pull request #634 from Marwes/block_comment_crlf
...
Avoid adding an extra newline after block comments
2015-11-21 12:47:53 +13:00
Markus Westerlind
ad7dc420cd
Avoid adding an extra newline after block comments
...
When block comments were rewritten to line comments they check if a new line needs to be added and adds one if needed. It only checked for '\n' however which would cause a newline to be added even if the comment was ended by "\r\n"
2015-11-20 23:31:05 +01:00
Marcus Klaas
9fe3c08abc
Add option to disable (un)wrapping of match arms
2015-11-20 21:50:25 +01:00
Marcus Klaas
7b0cceafee
Force chains to adhere to restrictions
2015-11-20 21:09:34 +01:00
Nick Cameron
3533f72c45
Merge pull request #618 from zyphrus/master
...
Comments in structs use appropriate style
2015-11-20 18:14:26 +13:00
David Barnett
b3f41e82fc
Use tactic instead of config
...
Add mixed test
Mixed is unreachable as there is no input combination that could get
to this value
2015-11-20 10:37:00 +13:00
Kevin Yeh
fbd1398c92
Implement Rewrite for ast::Stmt
2015-11-19 14:23:56 -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