topecongiro
ec4b439484
Disallow overflowing closure if there are multiple closures in args
2017-06-19 12:07:20 +09:00
topecongiro
0b13420943
Apply the same overflowing rule to tuple as function call
2017-06-19 11:24:36 +09:00
Nick Cameron
82d95cc4e0
Merge pull request #1724 from topecongiro/multiline-string-lit
...
Align multiline string literal
2017-06-19 13:02:21 +12:00
Nick Cameron
392d34b507
Merge pull request #1711 from topecongiro/combine-control-flow-condition-body
...
Combine control flow condition and body
2017-06-19 13:00:27 +12:00
Nick Cameron
4368cd391e
Merge pull request #1719 from topecongiro/macro-on-rhs
...
Avoid line break when rhs of assignment is an invalid macro
2017-06-19 13:00:12 +12:00
Nick Cameron
34fa428471
make file_lines::Range public
2017-06-19 12:58:29 +12:00
Seiichi Uchida
75d86eb1a0
Format source codes
2017-06-18 22:45:08 +09:00
Seiichi Uchida
ae9ce7bcd9
Align multiline string literal
2017-06-18 22:44:56 +09:00
topecongiro
91bd1fdc86
Format source codes
2017-06-18 14:29:17 +09:00
topecongiro
3dcd3d7fb0
Combine condition and body of control flow
...
If the condition of control flow expressions ends with closing parens and alike,
put the opening bracket of the body on the same line with closing parens.
2017-06-18 14:27:58 +09:00
Seiichi Uchida
6afb0e856c
Avoid line break when rhs of assignment is an invalid macro
2017-06-18 14:25:21 +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
92634a8f69
Use correct budget for chain
2017-06-17 16:56:37 +09:00
topecongiro
7132814a71
Fix wrap_str
...
Use shape.width for the first line and shape.used_width() for the last line.
2017-06-17 16:54:25 +09:00
topecongiro
53273b8547
Try overflowing the last element of chain only if it goes multi line
2017-06-17 16:54:03 +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
ee0e9aeaae
Use special rules when overflowing the last argument
...
When overflowing the last argument of function call, if it is a closure,
we apply some special rules in order to avoid weird formatting.
2017-06-17 15:24:45 +09:00
topecongiro
af57d285aa
Use correct budget for function call args
2017-06-17 15:24:45 +09:00
Nick Cameron
06f351664b
Merge pull request #1705 from topecongiro/issue-1703
...
Preserve comments inside attributes
2017-06-17 16:58:11 +12:00
Nick Cameron
67b4f8a40c
Merge pull request #1698 from topecongiro/vec-semi
...
Use correct indentaion for vec! with semicolon
2017-06-17 16:55:43 +12:00
topecongiro
f60a810730
Preserve comments inside attributes
2017-06-17 05:44:54 +09:00
topecongiro
4a5871eccc
Use correct indentaion for vec! with semicolon
2017-06-16 13:57:37 +09:00
Nick Cameron
85ecaf99df
Config knows if an option was default or set
2017-06-16 16:49:54 +12:00
Nick Cameron
c5538d2a58
Merge pull request #1692 from topecongiro/chain/last-item
...
Allow overflowing the last item of chain only if it is multi-lined
2017-06-16 13:24:03 +12:00
topecongiro
208ff15954
Format source codes
2017-06-16 08:49:49 +09:00
topecongiro
d3d31a9f75
Allow overflowing the last item of chain only if it is multi-lined
...
By multi-lined we mean if it has more than 3 lines.
2017-06-16 08:47:33 +09:00
topecongiro
e7240f5e24
Add and remove comments
2017-06-16 08:28:12 +09:00
topecongiro
0d5768964b
Format source codes and add a test
2017-06-16 07:36:31 +09:00
topecongiro
2f17c31fa4
Wrap closure with a single control flow expr with multi line condition
2017-06-16 07:36:31 +09:00
topecongiro
e22fd0ce59
Refactor rewrite for closure
2017-06-16 07:30:47 +09:00
topecongiro
02f9251007
Refactor rewrite for ConrtolFlow
2017-06-16 07:30:46 +09:00
topecongiro
de10113c74
Update tests
...
Add more patterns and types
2017-06-15 16:55:31 +09:00
topecongiro
8a6e9f689b
Format source codes
2017-06-15 16:26:41 +09:00
topecongiro
a5138b1676
Use block indent for tuple pattern when fn_call_style is Block
2017-06-15 16:25:40 +09:00
Nick Cameron
a1fdc32d99
Merge pull request #1673 from topecongiro/get-tests-passing-again
...
Get tests passing again
2017-06-15 10:39:29 +12:00
Nick Cameron
2dde4547fc
Merge pull request #1666 from topecongiro/tuple-type
...
Block indent tuple type when fn_call_style is Block
2017-06-15 10:01:00 +12: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
496e958467
Put match arm guard on the next line if it contains new line
2017-06-14 20:36:28 +09:00
topecongiro
8955eb86e6
Direct format vec! instead of using rewrite_pair
2017-06-14 20:33:54 +09:00
Nick Cameron
5f1bab26c4
Move to Libsyntax
2017-06-14 14:01:56 +12:00
topecongiro
18806321e6
Use block indent style against tuple type
2017-06-14 09:29:39 +09:00
topecongiro
e2d51aeb41
Use correct span for MetaItem
2017-06-14 00:09:05 +09:00
topecongiro
384d985df9
Do not rely on format_missing for rewriting attributes
2017-06-14 00:08:31 +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
Nick Cameron
32e882789b
Change defaults to RFC style
2017-06-13 14:37:04 +12:00
Nick Cameron
14227ddc40
Merge pull request #1664 from topecongiro/where-rfc-style
...
Fix excessive indentation in trait where clause when using Rfc style
2017-06-13 14:28:57 +12:00
Nick Cameron
6c9e77cdb3
Merge pull request #1663 from topecongiro/issue-1660
...
Use with_emitter instead of with_tty_emitter
2017-06-13 14:28:19 +12:00
topecongiro
f084a8af96
Fix excessive indentation in trait where clause when using Rfc style
2017-06-13 10:18:55 +09:00
topecongiro
6e3394e635
Use with_emitter instead of with_tty_emitter
2017-06-13 09:18:14 +09:00
Nick Cameron
5531a93b57
Merge pull request #1657 from topecongiro/issue-1656
...
Put match arm's guard on new line if it exceeds max width
2017-06-13 11:58:16 +12: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
Nick Cameron
6ed3077651
Merge pull request #1654 from topecongiro/over-long-lines
...
Use block indent for args of macro if single line args exceeds max width
2017-06-13 09:41:59 +12:00
topecongiro
ad628f6acc
Force multi line if the first attempt of rewriting args failed
2017-06-12 18:34:38 +09:00
topecongiro
57fc39305d
Put guard on newline if it exceeds max width
2017-06-12 17:25:38 +09:00
topecongiro
9df1509d19
Use rewrite instead of visitor for attributes
2017-06-12 17:25:07 +09:00
topecongiro
d269189f19
Use correct indent for return type when it goes multi line
2017-06-12 16:23:10 +09:00
topecongiro
9ad499786d
Use block indent for args if single line args exceeds max width
2017-06-12 15:58:27 +09:00
topecongiro
62e9473d07
Update rewrite_trait_ref to return Option<String>
2017-06-12 08:53:19 +09:00
Nick Cameron
272b0b6f49
Merge pull request #1649 from topecongiro/issue-1648
...
Add offset to struct literal fields when `struct_lit_style` is `"Visual"`
2017-06-12 10:39:28 +12:00
Nick Cameron
5136e051fa
Merge pull request #1646 from topecongiro/issue-1606
...
Reset the error count of parser from the previous file
2017-06-12 10:37:50 +12: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
Seiichi Uchida
f2838595d5
Add visual offset when using struct_lit_style is Visual
2017-06-10 22:20:11 +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
762639e7fd
Reset the error count of parser from the previous file
2017-06-10 14:34:50 +09:00
topecongiro
c92064c30a
Force brace on new line if the signature ends with comment
2017-06-09 16:15:31 +09:00
Nick Cameron
c879d5ebd7
Merge pull request #1640 from topecongiro/issue-1632
...
Do not overwrite files when there are no diffs in Overwrite mode
2017-06-07 10:05:36 +12:00
topecongiro
a64037d0f0
Do not overwrite files when there are no diffs in Overwrite mode
2017-06-06 15:33:46 +09:00
Nick Cameron
de6bfc4ad7
Rebasing
2017-06-06 07:32:06 +02:00
topecongiro
27da80324c
Implement catch
2017-06-06 07:32:06 +02:00
topecongiro
647fd4ff77
Leave GlobalAsm and MacroDef without formatting
2017-06-06 07:32:06 +02:00
topecongiro
e994eac3f1
Format pub(restricted) properly
2017-06-06 07:32:06 +02: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
8ac9245df4
Merge pull request #1634 from topecongiro/impl-rewrite-attribute
...
Implement Rewrite trait for syntax::ast::Attribute
2017-06-06 17:11:10 +12:00
topecongiro
7be703a637
Implement Rewrite trait for syntax::ast::Attribute
2017-06-06 13:55:34 +09: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
450631ae67
Merge pull request #1633 from topecongiro/rfc/control-style
...
Do not add offset to match pattern when using Rfc style
2017-06-06 14:54:28 +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
topecongiro
86be2e7bf8
Do not add offset to match pattern when using Rfc style
2017-06-05 17:57:43 +09:00
topecongiro
7250a468f9
Format source codes
2017-06-05 15:32:21 +09:00
topecongiro
41b7cc6a73
Set combine_control_expr to false by default and true in rfc-rustfmt
2017-06-05 15:31:44 +09:00
topecongiro
0292640e14
Allow chain item to extend if the parent ends with closing parens and alike
2017-06-05 15:31:05 +09: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
Nick Cameron
14a1ea8193
Merge pull request #1629 from topecongiro/issue-982
...
Use recover_comment_removed in rewrite_static
2017-06-05 11:37:21 +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
b49269ad39
Forbid method chain to get combined if it uses multi line.
...
If the method chain goes multi line before the last element, disallow combining
the method chain.
2017-06-04 19:37:24 +09:00
topecongiro
fabbef2c3e
Add macro to block expr
2017-06-04 19:35:29 +09:00
topecongiro
a9f529cba4
Format source codes
2017-06-04 19:35:29 +09:00
topecongiro
4a0094f28f
Add combine_control_expr option
2017-06-04 19:35:29 +09:00
topecongiro
b548d8d773
Refactor rewrite_call
2017-06-04 19:35:29 +09:00
topecongiro
a01ad30459
Forbid line break between if and pattern
2017-06-04 19:35:29 +09:00
topecongiro
fef347cb9e
Add use_block_indent
method to RewriteContext
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
3e25e628a1
Merge pull request #1619 from topecongiro/config/format_if_else_cond_comment
...
Add format_if_else_cond_comment config option
2017-06-04 15:26:26 +12: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
topecongiro
aadd3e11f4
Unindent comment on top of else
2017-06-02 11:58:58 +09:00
Seiichi Uchida
5650411d64
Fix a typo
2017-06-02 11:20:49 +09:00
Nick Cameron
cdc3f9321c
Rename the Style::Default option to Legacy
2017-06-02 11:44:38 +12:00
Nick Cameron
0480f7e105
Merge pull request #1620 from topecongiro/rfc-if
...
Use correct line budget when using Rfc control style
2017-06-02 11:36:16 +12:00
topecongiro
fbd4b87329
Use correct one line budget when using Rfc control style
2017-06-01 19:59:50 +09:00
Seiichi Uchida
10c3632078
Format source codes
2017-06-01 12:08:25 +09:00
Seiichi Uchida
789abf063d
Use block indent style when visual indent failed
2017-06-01 12:08:20 +09:00
Ravi Khadiwala
3d0ea5a099
Fix typo in from_toml_path
2017-05-30 22:25:24 -05:00
Ravi Khadiwala
17995e1539
Expose methods to locate and load config
...
* Make method for searching parents for toml file public
* Make method for loading config from path directly public, tweak the
API since it was never returning None
2017-05-30 21:41:30 -05:00
Nick Cameron
4d0ee80e61
Merge pull request #1609 from topecongiro/nested-tuple
...
Put a space between nested tuple field
2017-05-31 11:58:03 +12:00
topecongiro
b63e3aaa83
Put a space between nested tuple field
2017-05-30 20:40:05 +09:00
Nick Cameron
cfa3d59974
Merge pull request #1608 from topecongiro/issue-1598
...
Fix index bug in write_snippet_inner
2017-05-30 15:28:44 +12:00
topecongiro
33a7357543
Fix index bug in write_snippet_inner
2017-05-30 10:53:48 +09:00
topecongiro
924a9b5cb6
Allow longer custom comment
2017-05-30 08:46:25 +09:00
Nick Cameron
b79094262f
Merge pull request #1604 from topecongiro/comment-group
...
Format comments with different opening in different manner
2017-05-30 08:53:22 +12:00
topecongiro
bcebe9e7de
Use different style when rewriting comment with different opener
2017-05-29 11:28:48 +09:00
Nick Cameron
9b79cb5c22
Merge pull request #1602 from topecongiro/attributes-on-expressions
...
Allow attributes on expressions
2017-05-28 18:34:50 +12:00
Nick Cameron
d82962d7ac
Merge pull request #1601 from topecongiro/issue-1600
...
Allow attributes in generics of impl
2017-05-28 18:32:15 +12:00
topecongiro
99c2eab5ac
Allow attributes on expressions
2017-05-28 11:44:41 +09:00
Seiichi Uchida
4402412b78
Allow attributes in generics of impl
2017-05-27 23:59:29 +09:00
Seiichi Uchida
a22228acee
Avoid unnecessary binary search in rewrite_call
2017-05-27 21:56:23 +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
fcffe854b8
Allow default associated types
2017-05-26 17:17:12 +09:00
topecongiro
554605d47c
Format source codes and add tests
2017-05-26 16:40:19 +09:00
topecongiro
15b988aed3
Allow macro to nested and overflowed like function call
2017-05-26 16:35:34 +09:00
topecongiro
b748fe8bec
Set inside_macro to false when rewriting args of macro
2017-05-26 16:34:58 +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
92270ba191
Add offset when rewriting index
2017-05-25 23:01:41 +09: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