topecongiro
5a81c7d4b0
Use correct BytePos for where when rewriting trait
2017-07-27 14:21:14 +09:00
topecongiro
c3cc8fcb13
Format defaultness
2017-07-27 09:43:35 +09:00
Nick Cameron
1f991d00e0
Merge pull request #1822 from topecongiro/issue-1172
...
Remove newlines between list elements for expressions
2017-07-27 11:15:53 +12:00
Seiichi Uchida
261865ecc9
Remove newlines between list elements for expressions
2017-07-26 22:43:36 +09:00
topecongiro
e523f053a3
Format source codes and update tests
2017-07-26 16:30:58 +09:00
Nick Cameron
8b5831b501
Merge pull request #1818 from topecongiro/issue-1194
...
Put braces on the next line if it exceeds max width
2017-07-26 11:40:41 +12:00
topecongiro
65ad7d3bb0
Put braces on the next line if it exceeds max width
2017-07-25 18:51:14 +09:00
topecongiro
a17993c14a
Force vertical layout when struct_variant_width is 0
2017-07-25 15:19:09 +09:00
Seiichi Uchida
8b970fcc9f
Format inner attributes wherever possible
2017-07-25 00:55:55 +09:00
topecongiro
68c6fe70fd
Format source codes and update tests
2017-07-21 17:57:31 +09:00
topecongiro
db5f77b7d0
Consider max_width when rewriting struct in single-line
2017-07-21 07:17:49 +09:00
Seiichi Uchida
a8b0a6e4c5
Format source codes and update tests
2017-07-20 00:42:00 +09:00
Seiichi Uchida
de403f4f65
Use offset_left instead of shrink_left
2017-07-20 00:41:36 +09:00
topecongiro
dcb953b901
Add trailing comma when using Mixed indent style with newline
2017-07-13 20:32:46 +09:00
topecongiro
6fd291981e
Sort imports in alphabetical and consistent order
2017-07-13 18:42:14 +09:00
topecongiro
2fb66cd1d3
Add trailing_semicolon config option
...
trailing_semicolon controls whether to add a trailing semicolon after break,
continue and return.
2017-07-12 14:16:06 +09:00
topecongiro
e3310a6a18
Format source codes
2017-07-11 21:53:10 +09:00
Seiichi Uchida
bc90a12b8d
Format union
2017-07-10 17:26:55 +09:00
topecongiro
65790f2b2a
Cover missing comments before and after where
2017-07-10 14:38:16 +09:00
Seiichi Uchida
bc63d69c3f
Format source codes
2017-07-10 02:24:59 +09:00
topecongiro
2dd8d6d097
Add Clone trait bound to write_list
2017-07-07 09:04:06 +09:00
Nick Cameron
cfec7ad593
Merge pull request #1745 from topecongiro/assignment
...
Put rhs of assignment on the next line if it fits in a single line
2017-07-07 11:54:06 +12:00
topecongiro
cb48435ff3
Format source codes
2017-07-05 18:31:37 +09:00
topecongiro
101df143cf
Refactor rewrite_static
2017-07-05 18:25:50 +09:00
topecongiro
6a7f866cfe
Format source codes
2017-07-05 18:12:43 +09:00
topecongiro
f8586bac2a
Handle comment at the last element in write_list
2017-07-05 18:01:34 +09:00
topecongiro
be5c40cbb9
Handle very long struct
2017-07-05 18:00:36 +09:00
topecongiro
332cc97986
Use block indent style for struct tuple
2017-07-05 18:00:36 +09:00
topecongiro
34b4a9d3c4
Add struct_field_align_threshold for vertical alignment
2017-07-03 18:54:41 +09:00
topecongiro
fb1225a8af
Use format_expr wherever single-lined block is not allowed
2017-06-20 22:35:16 +09:00
topecongiro
512c8c1edf
Apply config.trailing_comma wherever possible
2017-06-19 16:00:04 +09:00
topecongiro
91bd1fdc86
Format source codes
2017-06-18 14:29:17 +09:00
Nick Cameron
be18e7af90
Merge pull request #1717 from topecongiro/type-and-generics
...
Refactor format against types and generics
2017-06-18 15:57:34 +12:00
Seiichi Uchida
38c30a3e06
Refactor format against types and generics
...
Previous implementation relied on the fact that rustfmt used visual indent
style as a default. However, since now rustfmt uses block indent style against
most part of the code, we need some refactorings.
2017-06-18 02:00:58 +09:00
topecongiro
54233acc8e
Format source codes
2017-06-17 16:56:54 +09:00
topecongiro
e31f5eceac
Use correct span for Infer type inside closure header
2017-06-17 15:35:29 +09:00
topecongiro
b048fe6b35
Format source codes
2017-06-17 15:26:59 +09:00
topecongiro
208ff15954
Format source codes
2017-06-16 08:49:49 +09:00
topecongiro
8a6e9f689b
Format source codes
2017-06-15 16:26:41 +09:00
topecongiro
b8f11a4e3c
Format source codes
2017-06-14 20:39:07 +09:00
topecongiro
c06d487712
Add offset wherever necessary
2017-06-14 20:37:54 +09:00
topecongiro
c4d84b44ba
Avoid overflow
2017-06-14 00:06:48 +09:00
Nick Cameron
18ccd0190e
Rebasing
2017-06-13 14:49:47 +12:00
Nick Cameron
6f30d9e7c9
Reformat tests
2017-06-13 14:42:54 +12:00
Nick Cameron
1f512948a0
Reformat source code using new defaults
2017-06-13 14:41:49 +12:00
topecongiro
f084a8af96
Fix excessive indentation in trait where clause when using Rfc style
2017-06-13 10:18:55 +09:00
Nick Cameron
5d78d1fe00
Merge pull request #1655 from topecongiro/issue-1652
...
Use correct indent for return type when it goes multi line
2017-06-13 11:57:30 +12:00
Nick Cameron
c07925f498
Merge pull request #1647 from topecongiro/refactor-impl-format
...
Refactor impl format
2017-06-13 11:55:33 +12:00
topecongiro
d269189f19
Use correct indent for return type when it goes multi line
2017-06-12 16:23:10 +09:00
topecongiro
62e9473d07
Update rewrite_trait_ref to return Option<String>
2017-06-12 08:53:19 +09:00
topecongiro
f135641cc8
Use multi line when type bounds does not fit in a single line
2017-06-11 23:26:49 +09:00
topecongiro
9b195ae228
Refactor format_impl
2017-06-11 14:32:44 +09:00
topecongiro
bd80077be8
Add format_trait_ref_then_update_result
2017-06-10 21:07:38 +09:00
topecongiro
88e522f921
Use multiline in generics rather than fail
2017-06-10 19:45:23 +09:00
topecongiro
9eefc6fc8d
Share codes when rewriting generics
2017-06-10 18:31:01 +09:00
topecongiro
c92064c30a
Force brace on new line if the signature ends with comment
2017-06-09 16:15:31 +09:00
est31
727963afe4
Update syntex_syntax
...
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
Nick Cameron
6a9d7dab0d
Merge pull request #1637 from est31/master
...
Add config options for spaces around the colon in struct literal fields
2017-06-06 16:20:16 +12:00
Nick Cameron
130aa70e3a
Merge pull request #1621 from topecongiro/combining
...
Combine more expressions
2017-06-06 14:52:48 +12:00
est31
aa4cd311bb
Add config options for spaces around the colon in struct literal fields
...
In Rust, colons are used for three purposes:
* Type annotations, including type ascription
* Trait bounds
* Struct literal fields
This commit adds options for the last missing of the three purposes,
struct literal fields.
2017-06-06 03:50:58 +02:00
Nick Cameron
d04ab9e5ba
Merge pull request #1630 from topecongiro/issue-1115
...
Allow comments after attributes on enum fields
2017-06-05 11:41:52 +12:00
topecongiro
d7de5b7656
Allow comments after attributes on enum fields
2017-06-04 23:27:21 +09:00
topecongiro
dcc7f32152
Format source codes
2017-06-04 19:37:24 +09:00
topecongiro
a9f529cba4
Format source codes
2017-06-04 19:35:29 +09:00
topecongiro
d54634bd7c
Use recover_comment_removed in rewrite_static
2017-06-04 18:44:08 +09:00
Nick Cameron
6f1cb950d6
Merge pull request #1628 from topecongiro/issue-1113
...
Preserve the layout of comment after return type
2017-06-04 11:40:37 +12:00
Nick Cameron
3090086000
Merge pull request #1627 from topecongiro/issue-1624
...
Refactor vertical layout of function definition with options
2017-06-04 11:34:25 +12:00
topecongiro
15e936bfc7
Preserve the layout of comment after return type
2017-06-04 06:59:55 +09:00
Seiichi Uchida
dd13761f85
Organize vertical layout of function definition
2017-06-03 23:18:39 +09:00
Seiichi Uchida
9b7ba980cf
Use correct budget
2017-06-03 23:17:30 +09:00
Seiichi Uchida
d21792a730
Put opening paren next to multi line generic
2017-06-03 23:16:29 +09:00
Seiichi Uchida
08b5375776
Forbid trailing comma at the end of args of variadic functions
2017-06-03 15:03:08 +09:00
Seiichi Uchida
4402412b78
Allow attributes in generics of impl
2017-05-27 23:59:29 +09:00
Nick Cameron
8ac3fc36cc
Merge pull request #1597 from topecongiro/comments-after-attributes
...
Allow comments after attributes of struct fields
2017-05-27 13:47:42 +12:00
Nick Cameron
aad250e20e
Merge pull request #1596 from topecongiro/issue-1595
...
Add a trailing comma if the last arg ends with comment
2017-05-27 13:38:14 +12:00
Nick Cameron
2dc4298b71
Merge pull request #1593 from topecongiro/issue-1439
...
Allow comments after where clause
2017-05-27 13:34:50 +12:00
Nick Cameron
4e5df80c03
Merge pull request #1588 from topecongiro/nesting-macro
...
Allow macro to be nested like function call
2017-05-27 13:28:47 +12:00
topecongiro
b6c503ac32
Allow comments after attributes of struct fields
2017-05-27 09:36:25 +09:00
topecongiro
67e8a690ff
Add a trailing comma if the last arg ends with comment
2017-05-27 07:33:06 +09:00
topecongiro
dab14b4485
Allow comments after where clause
2017-05-27 02:07:58 +09:00
topecongiro
554605d47c
Format source codes and add tests
2017-05-26 16:40:19 +09:00
topecongiro
0869bca85a
Put closing paren on the next line when the last arg contains comment
2017-05-26 13:15:10 +09:00
Nick Cameron
3d135ebba4
Merge pull request #1586 from topecongiro/minor
...
Fix minor bugs
2017-05-26 08:43:52 +12:00
Seiichi Uchida
10c7934700
Be precise with one_line_budget for fn_base
2017-05-25 22:55:11 +09:00
topecongiro
86856491bc
Format source codes
2017-05-25 16:08:08 +09:00
Nick Cameron
393ba27311
Remove dependency on Itertools
2017-05-25 16:23:07 +12:00
topecongiro
04bb5d8929
Format source codes
2017-05-24 00:07:02 +09:00
topecongiro
ec33121aaf
Format source codes
2017-05-23 22:13:29 +09:00
topecongiro
77a2e9858b
Format source codes
2017-05-23 11:37:33 +09:00
Michael Killough
c3c2e823cb
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config
2017-05-18 13:05:19 +07:00
topecongiro
cfff3bd91e
Use multiline when signature does not fit single line
2017-05-17 16:31:09 +09:00
topecongiro
d7b6f1199f
Format source codes
2017-05-16 23:24:38 +09:00
Michael Killough
c0bdbfa531
Switch to accessing config items via method.
...
Preparation for #865 , which proposes adding a flag which outputs which
config options are used during formatting.
This PR should not make any difference to functionality. A lot of this
was search-and-replace.
Some areas worthy of review/discussion:
- The method for each config item returns a clone of the underlying
value. We can't simply return an immutable reference, as lots of
places in the code expect to be able to pass the returned value as
`bool` (not `&bool). It would be nice if the `bool` items could
return a copy, but the more complex types a borrowed reference... but
unfortunately, I couldn't get the macro to do this.
- A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
config items by modifying the fields of the `Config` struct directly.
They now use the existing `override_value()` method, which has been
modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
benefits of this are that the complex `file_lines` and `write_mode`
strings are now parsed in one place (`Config.override_value`) instead
of multiple. The disadvantages are that it moves the compile-time
checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
Seiichi Uchida
762db5138e
Format source codes
2017-05-15 22:55:45 +09:00
Nick Cameron
459b4449a6
Merge pull request #1442 from topecongiro/poor-formatting/trailing-comma
...
Remove comma from function definition with a single argument
2017-05-08 10:45:03 +12:00
topecongiro
e923df4146
Add indented and with_max_width
2017-05-08 07:24:12 +09:00
topecongiro
e7c6d34854
Use SeperatorTactic::Never for a single argument
2017-05-04 14:47:50 +09:00
topecongiro
f5da9d779f
Format source codes
2017-05-03 11:26:25 +09:00
topecongiro
93dae1a34d
Add test for empty tuple struct with comment
2017-05-02 10:21:39 +09:00
topecongiro
2e00c117e5
Handle empty tuple struct def properly
2017-05-02 10:21:39 +09:00