Commit Graph

47 Commits

Author SHA1 Message Date
Andrey
950b288d6f do not remove discriminant value if exists (#3771) (#3772) 2019-09-04 23:01:04 +09:00
Seiichi Uchida
b5449ba785
Allow overflowing rhs of unit variant (#3566) 2019-05-22 10:51:19 +09:00
Nick Cameron
8b709c0019 Add attr_fn_like_width to the width heuristics
It is a bit larger than than `fn_call_width` which we used previously, so fewer attributes get reformatted.

Closes #2929
2018-10-12 15:20:42 +13:00
Stéphane Campinas
8b3788d875
rewrite_string: allow to break on a boundary character that is on edge 2018-10-08 14:48:15 +02:00
Seiichi Uchida
6e901c8f37 Format and update test 2018-09-30 08:05:45 +09:00
Nick Cameron
888abbb0ec
Merge pull request #2820 from scampi/defaults
[wip] remove some defaults
2018-07-01 10:57:31 +12:00
Stéphane Campinas
87f72d4333
removed comment with default: rustfmt-error_on_line_overflow 2018-06-27 01:36:01 +02:00
Nick Cameron
3abebf95ce Apply short function call heuristic to attributes
Closes #2620
2018-06-26 15:18:17 +12:00
Nick Cameron
51f566062f Update uses of rustfmt_skip to rustfmt::skip 2018-05-14 16:25:10 +12:00
topecongiro
89d8eabba5 Add tests for #2594 2018-04-28 13:23:50 +09:00
Seiichi Uchida
e5b403c944 Update tests 2018-03-28 17:42:24 +09:00
Seiichi Uchida
67fa394e4e Restrict the width of doc comments with comment_width
See the diff in tests/target/enum.rs for an example.
2018-03-09 09:34:13 +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
Seiichi Uchida
c60d865b98 Put attributes and enum variants on different lines 2018-01-26 16:20:00 +09:00
Seiichi Uchida
6e05ca87b0 Add a test for #2343 and update tests 2018-01-11 16:53:13 +09:00
Seiichi Uchida
366621eb46 Add a test for #2123 and update tests 2017-12-17 15:23:17 +09:00
Seiichi Uchida
89f27764ed Cargo fmt and update tests 2017-12-02 17:45:39 +09:00
topecongiro
3d7d978fe8 Add a test for #2193 2017-11-27 20:53:54 +09:00
topecongiro
9ece82f9ea Add a test for #2190 2017-11-27 13:49:53 +09:00
topecongiro
b1a6dd6b83 Cargo fmr & update tests
Note that we are forcing vertical layout when there are attributes on top of a
variant.
2017-11-16 16:07:15 +09:00
topecongiro
b3a3d5b164 Add a test for #1809 2017-11-16 16:01:50 +09:00
topecongiro
61bca9c083 Update a test 2017-11-08 18:24:18 +09:00
Seiichi Uchida
271da96098 Add a test for #2098 2017-10-30 23:38:05 +09:00
topecongiro
a67b8b0bbb Use rewrite_assign_rhs when rewriting unit variant 2017-10-25 01:08:32 +09:00
topecongiro
2915167179 Cargo fmt and update tests 2017-09-19 11:41:50 +09:00
topecongiro
f35a420597 Update tests 2017-08-11 17:54:30 +09:00
topecongiro
2376582dfb Update tests 2017-08-11 17:54:20 +09:00
topecongiro
d97ecd319d Update tests 2017-07-25 18:51:29 +09:00
topecongiro
a4cce31ea9 Update tests 2017-07-07 09:04:06 +09:00
topecongiro
332cc97986 Use block indent style for struct tuple 2017-07-05 18:00:36 +09:00
Nick Cameron
6f30d9e7c9 Reformat tests 2017-06-13 14:42:54 +12:00
topecongiro
7be703a637 Implement Rewrite trait for syntax::ast::Attribute 2017-06-06 13:55:34 +09:00
topecongiro
d7de5b7656 Allow comments after attributes on enum fields 2017-06-04 23:27:21 +09: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
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
775de8a62b Optionally put short struct variants on one line (#997)
Closes #418
2016-05-18 22:38:49 +02:00
Nick Cameron
7ac354fd09 Don't be so aggressie about line-breaking strings (#911)
We will no longer break in the middle of words, only at whitespace or punctuation.

This means we sometimes over-run, but that seems better than some of the bad splits we see.

Closes #369
2016-04-11 20:45:47 +02:00
Nick Cameron
b7d61254a7 Option to disable line breaking in comments
Set to false by default for now, since we are having a lot of problems with comments. We should set to true once we have a better algorithm.
2015-11-10 08:03:01 +13:00
Marcus Klaas
11756d2ef8 Refactor enum formatting 2015-10-19 21:28:05 +02:00
mwiczer
5162282b60 Support pre- and post-comments for enums
Use lists to format enum variants rather than special formatting.
Add tests for enums mostly around block comments.
2015-10-08 17:22:57 -04:00
Nick Cameron
9139a8040c Merge pull request #379 from marcusklaas/enum-quik-fix
Fix variant name duplication on rewrite failure
2015-09-28 07:51:09 +13:00
Marcus Klaas
a673fef844 Fix variant name duplication on rewrite failure 2015-09-27 17:23:37 +02:00
Nick Cameron
ba51535a74 Fixup tests 2015-09-27 19:39:58 +13:00
Gaëtan Cassiers
83290f15ad Add comma after struct-like enum variant
This is mandatory.
2015-07-03 10:30:42 +02:00
Marcus Klaas
0ef5db9496 Format tuple-like structs 2015-06-23 16:54:42 +02:00
Marcus Klaas
34b2721010 Fixup tests 2015-06-08 18:22:55 +02:00