Seiichi Uchida
b897310d79
Prefer to put the whole pattern of match arm on one line
2017-07-10 02:20:28 +09:00
Seiichi Uchida
72b155a9e2
Implement rhs_overhead method against Shape
2017-07-10 02:16:57 +09:00
Nick Cameron
7333dfc95b
Merge branch 'master' of https://github.com/petrochenkov/rustfmt into petrochenkov-master
2017-07-08 11:22:53 +12:00
Vadim Petrochenkov
d4c8a17665
Update rustfmt for ast::ExprKind::MethodCall changes
2017-07-07 15:52:23 +03:00
topecongiro
f7ec959c97
Use closure instead of declaring function
...
Take comment overhead into account
2017-07-07 09:04:06 +09:00
topecongiro
57466dc687
Format source codes
2017-07-07 09:04:06 +09:00
topecongiro
1de786a79a
Implement vertical alignment for comments after list structure
2017-07-07 09:04:06 +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
Nick Cameron
b9a1938098
Merge pull request #1768 from topecongiro/huge-array
...
Add array_horizontal_layout_threshold option
2017-07-07 06:48:48 +12:00
topecongiro
8e8e7a4215
Add array_horizontal_layout_threshold option
2017-07-06 01:19:36 +09:00
topecongiro
d613f75676
Use correct one line budget for array in Block indent style
2017-07-05 19:19:54 +09:00
topecongiro
cb48435ff3
Format source codes
2017-07-05 18:31:37 +09:00
topecongiro
0237347abc
Update heuristic in rewrite_assign_rhs
...
Put the rhs of assignement on the next line when putting next to `lhs = ` will
cause rhs to go multi line, but putting on the next line makes it fits
in a single line.
2017-07-05 18:30:11 +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
Nick Cameron
6546aaf5ec
Merge pull request #1767 from topecongiro/range-with-floating-literal
...
Add a space before range if lhs ends with dot
2017-07-05 15:46:43 +12:00
Nick Cameron
734de8b2b7
Merge pull request #1765 from topecongiro/v-alignment/struct-field
...
Add vertical alignment option for struct fields
2017-07-05 12:11:52 +12:00
topecongiro
183e3482e5
Add a space before range if lhs ends with dot
2017-07-04 20:23:57 +09:00
Nick Cameron
2400f39f98
Merge pull request #1757 from topecongiro/rfc/combine-array
...
Rfc: Combine Array
2017-07-04 18:22:32 +12:00
Nick Cameron
960dd3242a
Merge pull request #1756 from topecongiro/closure_block_indent_threshold
...
Use correct one line budget in rewrite_closure_block
2017-07-04 18:21:11 +12:00
Nick Cameron
617578146f
Merge pull request #1752 from topecongiro/supress-write-mode-warning
...
Suppress write mode warning
2017-07-04 18:11:48 +12:00
topecongiro
34b4a9d3c4
Add struct_field_align_threshold for vertical alignment
2017-07-03 18:54:41 +09:00
topecongiro
bd991851c8
Format source codes
2017-07-03 18:54:26 +09:00
topecongiro
89aaf3bf03
Use correct width and tactic for struct literal
2017-07-03 18:53:47 +09:00
topecongiro
7eafad96ad
Implement Spanned for ast::StructField and ast::Field
2017-07-03 18:48:21 +09:00
topecongiro
4e0882ea67
Combine Array
2017-06-29 11:01:12 +09:00
topecongiro
0199e08367
Use correct one line budget in rewrite_closure_block
2017-06-28 10:56:29 +09:00
topecongiro
747481068c
Add an option to inhibit warning on write-mode change
2017-06-27 11:28:28 +09:00
topecongiro
5f77581763
Put multi-lined index on the next line if it fits in one line
2017-06-26 07:57:06 +09:00
topecongiro
eeb5599b4b
Do not add trailing comma inside macro invocation unless there already is
2017-06-23 13:43:43 +09:00
topecongiro
60f0c576c9
Preserve trailing comma of macro invocation
2017-06-23 12:59:47 +09:00
Georg Brandl
b95666b20c
Handle proc-macro crates in cargo-fmt
2017-06-21 07:32:23 +02:00
topecongiro
64fc9e31e7
Fix a typo
2017-06-20 22:38:14 +09:00
topecongiro
fb1225a8af
Use format_expr wherever single-lined block is not allowed
2017-06-20 22:35:16 +09:00
topecongiro
eeb20e2033
Refactor rewrite for ast::Block
2017-06-20 22:35:16 +09:00
Nick Cameron
90251c32ff
Add warning about write-mode change
2017-06-20 18:47:32 +12:00
Seiichi Uchida
f74be44b1c
Merge pull request #1732 from olson-sean-k/issue-1377
...
Keep brace on same line as `match` when using `ClosingNextLine`.
2017-06-20 12:07:03 +09:00
Nick Cameron
c4b662625b
Merge pull request #1735 from kogai/public-file-lines
...
Public file-lines constructor
2017-06-20 13:09:43 +12:00
Nick Cameron
1ebbc3cd68
Merge pull request #1734 from topecongiro/raw-string-literal
...
Allow extending a chain after raw string literal
2017-06-20 12:29:25 +12:00
Nick Cameron
6f51e9454e
Merge pull request #1733 from topecongiro/cargo-fmt
...
Do not run cargo fmt if there are unnecessary arguments
2017-06-20 12:28:36 +12:00
Nick Cameron
779f037c8d
Merge pull request #1728 from topecongiro/trailing-comma
...
Apply config.trailing_comma wherever possible
2017-06-20 12:22:58 +12:00
Seiichi Uchida
53202b4029
Do not run cargo fmt if there are unnecessary arguments
2017-06-19 23:39:59 +09:00
Sean Olson
d7298fbd97
Keep brace on same line as match
when using ClosingNextLine
for control_brace_style
.
2017-06-19 07:14:51 -07:00
Seiichi Uchida
b99f3cb447
Allow extending a chain after raw string literal
2017-06-19 22:06:08 +09:00
shinichi kogai
325d02bcc7
Public file-lines constructor
2017-06-19 21:14:33 +09:00
topecongiro
512c8c1edf
Apply config.trailing_comma wherever possible
2017-06-19 16:00:04 +09:00
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