Nick Cameron
0e1fa2c244
Remove indent_match_arms
2017-11-27 15:49:14 +13:00
Nick Cameron
86007e7d17
Remove where_density
and where_layout
options
...
There is a choice between block and visual indent for where clauses, plus the
single line option. I think these two are too fine-grained to be useful.
2017-11-24 21:08:24 +13:00
Nick Cameron
abfa4a1473
Merge pull request #2184 from topecongiro/issue-2179
...
Put rhs on the same line as lhs if putting rhs on next line exceeds max width
2017-11-24 20:19:12 +13:00
Nick Cameron
dd1fbca99a
Replace various small width heuristics with a single option
...
Closes #1984
2017-11-24 20:17:06 +13:00
topecongiro
cb5c3a9914
Add a test for #2179
2017-11-24 12:04:00 +09:00
Nick Cameron
96886cd67f
Fix a typo in the unstable options handling and address fallout
2017-11-24 15:41:27 +13:00
Nick Cameron
f891d04c87
Some tests I renamed in a previous commit and forgot to git add
2017-11-24 14:46:33 +13:00
Nick Cameron
45d4f7a2dd
struct_lit_multiline_style -> struct_lit_single_line (and make it a bool)
2017-11-24 14:45:18 +13:00
Nick Cameron
20805acf42
Merge attributes_on_same_line_as_field
and attributes_on_same_line_as_variant
into same_line_attributes
2017-11-24 14:29:44 +13:00
Nick Cameron
4cb474b5ee
Remove force_format_strings
in favour of format_strings
2017-11-24 14:07:37 +13:00
Nick Cameron
8a7b6b8806
Remove match_pattern_separator_break_point
in favour of binop_separator
2017-11-24 14:01:44 +13:00
Nick Cameron
179b3c59de
Remove legacy option fn_args_paren_newline
2017-11-24 13:27:14 +13:00
Nick Cameron
4f65124422
Remove legacy option fn_return_indent
2017-11-24 13:19:36 +13:00
Nick Cameron
d0f12b8ec8
Remove unused option take_source_hints
2017-11-24 13:08:02 +13:00
topecongiro
334b410785
Add a test for #2111
2017-11-23 12:36:57 +09:00
topecongiro
c2804589a1
Add a test for assignment whose lhs is exactly 100 chars
2017-11-21 08:50:55 +09:00
topecongiro
44d81d9e0e
Add a test for #2171
2017-11-20 16:38:15 +09:00
topecongiro
3de7a56267
Add a test for #2164
2017-11-18 15:32:10 +09:00
topecongiro
b3a3d5b164
Add a test for #1809
2017-11-16 16:01:50 +09:00
topecongiro
37b6855d9d
Add a test for #2158
2017-11-16 11:26:12 +09:00
topecongiro
f9f4ef8177
Add a test for #1603
2017-11-15 15:44:27 +09:00
topecongiro
bf775785e0
Add a test for #2151
2017-11-15 12:22:50 +09:00
Nick Cameron
a90b76a731
Merge pull request #2153 from topecongiro/issue-2152
...
Return None when a literal exceeds budget
2017-11-15 15:43:03 +13:00
topecongiro
00318c400b
Add a test for #2152
2017-11-15 10:36:42 +09:00
topecongiro
575ae22a5f
Update tests related to spaces with parens and brackets
2017-11-14 23:37:27 +09:00
topecongiro
15ded04f46
Update tests related to colon spacing
2017-11-14 23:25:10 +09:00
topecongiro
f8074b340d
Combine fn_brace_style and item_brace_style
2017-11-14 10:47:02 +09:00
topecongiro
0d721241f4
Change chain_indent to indent_style
2017-11-13 17:33:32 +09:00
topecongiro
5e639cacdb
Change Legacy to Visual
2017-11-13 17:33:32 +09:00
topecongiro
18a513b0c2
Change Rfc to Block
2017-11-13 17:33:32 +09:00
topecongiro
96f3c36c04
Replace '_indent' with 'indent_style'
2017-11-13 17:33:32 +09:00
Nick Cameron
8a27a2da62
Add a test for #1524
2017-11-13 16:51:28 +13:00
Nick Cameron
e6800bf27d
remove closure_block_indent_threshold option
2017-11-13 15:40:54 +13:00
topecongiro
1f5f9533d0
Add a test for where clause on unit struct
2017-11-13 11:06:09 +09:00
Nick Cameron
1a6d117719
Merge pull request #2145 from topecongiro/issue-2144
...
Format generics on unit struct
2017-11-13 13:01:37 +13:00
topecongiro
8685cdadda
Add a test for #2144
2017-11-13 08:01:52 +09:00
Seiichi Uchida
881c5b5a6d
Add a test for #2021
2017-11-11 23:14:01 +09:00
Nick Cameron
ba8233d361
Merge pull request #2138 from topecongiro/comments-around-trait-bounds
...
Comments around trait bounds
2017-11-11 10:19:35 +13:00
Seiichi Uchida
38a5350dcd
Add a test for #2055
2017-11-10 21:20:54 +09:00
topecongiro
a9647f1108
Add a test for #2025
2017-11-10 17:08:16 +09:00
Nick Cameron
560f66cfe3
Merge pull request #2130 from topecongiro/soft-wrapping-doc-comments
...
Soft wrapping doc comments
2017-11-09 16:12:27 +13:00
topecongiro
b7f69ce776
Add a test for soft wrapping on doc comments
2017-11-08 18:23:21 +09:00
Nick Cameron
0c250d0e5d
Merge pull request #2128 from topecongiro/issue-2125
...
Wrap long single field tuple struct
2017-11-08 21:11:21 +13:00
topecongiro
bbfdb12c3e
Add a test for #2125
2017-11-08 11:52:14 +09:00
topecongiro
d2d5ebe4da
Add a test for #2126
2017-11-08 08:25:09 +09:00
Afshin Mehrabani
f412c875ea
Adding where_single_line option ( #2030 )
...
* feat(where): adding where_single_line option and tests
* fix(where): adding more tests
* feat(where): changing the shape of where clause when where_single_line is true
* feat: newline_for_brace should avoid adding a new line where where_single_line is true
* fix(items): where_single_line should bypass the multi-item where clauses
* fix(items): refactoring and removing redundant variables
* fix(items): where_single_line should not be functional when args are multilined
* fix(config): fixing conflict with upstream
2017-11-06 11:53:17 +13:00
Nick Cameron
f1035d9782
Merge pull request #2116 from topecongiro/config-options-indent
...
Rename config options related to indent
2017-11-06 08:43:12 +13:00
Nick Cameron
15894e94ef
Merge pull request #2115 from topecongiro/chain_width
...
Rename 'chain_one_line_max' to 'chain_width'
2017-11-06 08:38:37 +13:00
topecongiro
9cd5d88854
Rename test files
2017-11-04 22:49:21 +09:00
topecongiro
40c5666af6
Rename 'struct_lit_style' to 'struct_lit_indent'
2017-11-04 22:47:28 +09:00
topecongiro
d5d8740993
Rename 'fn_call_style' to 'fn_call_indent'
2017-11-04 22:46:40 +09:00
topecongiro
55c2000d94
Rename 'fn_args_layout' to 'fn_args_indent'
2017-11-04 22:45:47 +09:00
topecongiro
5096cdff56
Rename 'array_layout' to 'array_indent'
2017-11-04 22:45:09 +09:00
topecongiro
619bc91081
Change test files' name
2017-11-04 22:30:26 +09:00
topecongiro
d287b06eba
Rename 'chain_one_line_max' to 'chain_width'
2017-11-04 22:24:43 +09:00
topecongiro
af3d793e30
Add more tests
2017-11-03 23:38:32 +09:00
topecongiro
691bc3bbd7
Add a test for structs with visibility
2017-11-03 22:25:30 +09:00
Nick Cameron
f15dd870d1
Merge pull request #1877 from topecongiro/overflowing-closure-with-loop
...
Force to use block for closure body with a single control flow expression
2017-11-03 17:08:34 +13:00
topecongiro
49409c0096
Update tests
2017-11-02 21:38:20 +09:00
topecongiro
dc035bbbee
Add a test to see if tuple struct gets combined
2017-11-02 20:28:38 +09:00
Nick Cameron
809e06ee32
Merge pull request #2102 from topecongiro/soft-wrapping-comments
...
Soft wrapping for comments
2017-11-02 15:15:38 +13:00
Martin Lindhe
f930a16b8d
fix some typos
2017-11-01 07:33:55 +01:00
topecongiro
371d2bb939
Add a test for soft wrapping for comments
2017-10-31 15:01:38 +09:00
Nick Cameron
0af8825eb1
Merge pull request #2101 from topecongiro/issue-2099
...
Format match expr with empty body
2017-10-31 08:26:08 +13:00
Seiichi Uchida
271da96098
Add a test for #2098
2017-10-30 23:38:05 +09:00
Seiichi Uchida
792f48c976
Add a test for #2099
2017-10-30 23:37:26 +09:00
Paul Lietar
c1e897907a
Add suport for extern types.
...
See https://github.com/rust-lang/rust/pull/44295
2017-10-30 08:46:11 +13:00
Nick Cameron
5233f9cde0
Add support for crate
shorthand for pub(crate)
2017-10-28 18:41:58 +13:00
Nick Cameron
90b3222adb
Merge pull request #2090 from topecongiro/issue-2087
...
Only read the trailing comma of outermost fn call
2017-10-27 15:18:13 +05:30
Nick Cameron
f159d32c1f
Merge pull request #2089 from topecongiro/closure-block-body-with-comment
...
Fix rustfmt failing to format closure block body with comment
2017-10-27 15:17:38 +05:30
Nick Cameron
6cfeb1fa78
Merge pull request #2041 from osa1/match_arm_newline
...
[not ready] Implement match_arm_forces_newline option (#2039 )
2017-10-27 15:17:03 +05:30
topecongiro
daf4789b76
Add a test for #2087
2017-10-27 16:35:40 +09:00
topecongiro
9de9693a45
Add a test
...
rustfmt fails to format a function call when it has a single closure argument
and that closure has a block body which contains comments at the beginnig of
the block, and the block only contains a single expression as its statement.
Phew!
2017-10-27 15:39:15 +09:00
Nick Cameron
0a59654b41
Merge pull request #2084 from topecongiro/issue-2081
...
Use rewrite_assign_rhs when rewriting unit variant
2017-10-27 02:15:22 +05:30
Nick Cameron
038f711c6e
Merge pull request #2083 from topecongiro/issue-2082
...
Use a correct span for fn with pub(crate) syntax
2017-10-27 02:14:29 +05:30
Nick Cameron
4386fc218b
Merge pull request #2068 from topecongiro/issue-2067
...
Fix a subtle bug in rewriting chain
2017-10-27 01:38:10 +05:30
Ömer Sinan Ağacan
84bea05719
Add tests
2017-10-26 20:20:36 +03:00
topecongiro
a67b8b0bbb
Use rewrite_assign_rhs when rewriting unit variant
2017-10-25 01:08:32 +09:00
topecongiro
7b9a4e6a06
Use a correct span for fn with pub(crate) syntax
2017-10-25 00:51:04 +09:00
Matthew McAllister
1853d02ea9
Handle #![rustfmt_skip]
in block statements
2017-10-20 02:37:52 -07:00
topecongiro
8b7defdb19
Add a test for #2067
2017-10-18 22:23:25 +09:00
Seiichi Uchida
7cbdf35f63
Add a test for #2063
2017-10-17 00:12:22 +09:00
Nick Cameron
5798fe6e13
Merge pull request #2045 from topecongiro/issue-2044
...
Simplify multiline case in rewrite_struct_field()
2017-10-13 21:59:13 +08:00
Bryce Van Dyk
f3ceb54d3a
Add a test for issue 1211, showing it's no longer an issue.
...
Since rustfmt has moved away from syntex the overflow seen in issue 1211
is no longer a problem. This commit adds a test to verify that.
2017-10-10 18:51:44 +13:00
Seiichi Uchida
be9b1b5332
Add a test for #2044
2017-10-08 22:37:13 +09:00
Chris Emerson
27e269ec5b
Add a test that the skip attribute applies to other attributes.
2017-10-06 22:57:59 +01:00
Nick Cameron
81f0e9c94e
Merge pull request #2032 from topecongiro/trailing-whitespaces-in-macro-def
...
Remove trailing whitespaces in macro def
2017-10-05 19:34:12 +08:00
topecongiro
00f8610d9b
Add a test
2017-10-05 19:44:45 +09:00
Nick Cameron
69ab2b5f5e
Merge pull request #2023 from topecongiro/issue-2020
...
Use a correct budget for where predicate
2017-10-05 18:09:49 +08:00
Nick Cameron
61043e64e0
Merge pull request #2019 from topecongiro/issue-2018
...
Break after '=' if a single line rhs exceeds max width
2017-10-05 17:30:45 +08:00
Nick Cameron
2abe119d88
Merge pull request #2017 from topecongiro/issue-1987
...
Format strings in attributes when `format_strings = true`
2017-10-05 17:27:17 +08:00
Bryce Van Dyk
3422ebadf3
Uncomment fixme associated with #184 in loop.rs as this issue is fixed.
2017-10-04 22:02:28 +13:00
Seiichi Uchida
1752929983
Update tests
2017-10-02 00:04:58 +09:00
Seiichi Uchida
c0997260ba
Update tests
2017-10-01 21:21:20 +09:00
topecongiro
bdcd36e677
Add a test for #1987
2017-10-01 20:30:32 +09:00
Nick Cameron
6e41100725
Merge pull request #2005 from topecongiro/issue-2003
...
Put the opening brace of fn body on the next line if it exceeds max width
2017-09-29 21:27:37 +08:00
Nick Cameron
ce62f0a7ec
Merge pull request #1997 from topecongiro/issue-1995
...
Fix a budget bug in Arg::rewrite()
2017-09-29 20:40:53 +08:00
topecongiro
c66560fee6
Add a test for #2003
2017-09-28 20:15:33 +09:00
Badel2
feb7a6a0a6
Replace ...
by ..=
in range expr tests
2017-09-27 22:47:34 +02:00
topecongiro
dd0dcdf1ac
Fix a budget bug in Arg::rewrite()
2017-09-26 11:20:47 +09:00
topecongiro
2915167179
Cargo fmt and update tests
2017-09-19 11:41:50 +09:00
Seiichi Uchida
bb4a6bf66a
Update tests
2017-09-15 22:32:03 +09:00
Seiichi Uchida
97d9e6b373
Use the last line's width for indent width in rewriting missed span
...
to fix unindented comments
2017-09-05 16:54:02 +09:00
Nick Cameron
435ab867c3
Merge pull request #1945 from topecongiro/issue-1095
...
Exclude prefix colon from span when rewriting comment
2017-09-05 11:00:31 +12:00
Nick Cameron
84e7ef0ab7
Merge pull request #1944 from topecongiro/issue-1943
...
Take attributes_on_same_line_as_field into account
2017-09-05 10:53:36 +12:00
Seiichi Uchida
c720a3a38e
Remove colon from faulty span
2017-09-05 01:04:31 +09:00
topecongiro
467b7b5a6c
Take attributes_on_same_line_as_field into account
2017-09-04 16:15:32 +09:00
topecongiro
47062c8f0a
Format long derive
2017-09-03 08:14:00 +09:00
Nick Cameron
59d1e84259
Merge pull request #1937 from topecongiro/enhance-macro-rewrite
...
Enhance macro rewrite
2017-08-31 17:43:52 +12:00
topecongiro
848d4559e1
Enhance macro rewrite
2017-08-31 13:52:13 +09:00
topecongiro
16894b9cd2
Put the closing brace of empty enum on the same line with the opening brace
2017-08-31 12:44:40 +09:00
Vadim Petrochenkov
6e5c6f5ba3
Use getters to access Span
fields
2017-08-31 14:14:13 +12:00
topecongiro
979d131c5d
Format and preserve attributes on ast::Stmt
2017-08-30 19:27:36 +09:00
Nick Cameron
7298ce9d52
Merge pull request #1925 from topecongiro/enhance-comment
...
Enhance comment formatting
2017-08-28 09:33:08 +12:00
Nick Cameron
4b90fb140f
Merge pull request #1924 from topecongiro/issue-1922
...
Fix a typo in calculating overhead for fn args
2017-08-28 09:08:18 +12:00
topecongiro
25bf1741b2
Update tests
2017-08-28 00:18:17 +09:00
topecongiro
ef84319e47
Fix a typo in calculating overhead for fn args
2017-08-27 14:57:21 +09:00
topecongiro
343b315830
Handle macros with tabs
2017-08-27 13:44:49 +09:00
topecongiro
24efc3a934
Ignore empty lines inside arguments of macro with brace
2017-08-25 22:35:22 +09:00
topecongiro
34cf16436a
Add a test for #1914 and #1915
2017-08-25 08:20:11 +09:00
topecongiro
669a139956
Only merge consecutive derives
2017-08-24 23:48:18 +09:00
topecongiro
5dafcc24e4
Add merge_derives config option
2017-08-24 22:29:56 +09:00
Nick Cameron
ba6121c4e2
Merge pull request #1898 from spinda/overflow-controls
...
Add overflow_closures and overflow_match_arms opts
2017-08-24 18:10:51 +12:00
Michael Smith
411c73c12f
Add multiline_{closure,match_arm}_forces_block
...
multiline_closure_forces_block = false (default):
result.and_then(|maybe_value| match maybe_value {
None => ...,
Some(value) => ...,
})
multiline_closure_forces_block = true:
result.and_then(|maybe_value| {
match maybe_value {
None => ...,
Some(value) => ...,
}
})
multiline_match_arm_forces_block = false (default):
match lorem {
None => if ipsum {
println!("Hello World");
},
Some(dolor) => ...,
}
multiline_match_arm_forces_block = true:
match lorem {
None => {
if ipsum {
println!("Hello World");
}
}
Some(dolor) => ...,
}
2017-08-21 14:05:20 -07:00
Seiichi Uchida
a18a40cbc1
Add indent to macro we could not format
2017-08-21 23:19:01 +09:00
Nick Cameron
7e171836c6
Merge pull request #1900 from spinda/attributes-on-same-line
...
Add attributes_on_same_line_as_{field,variant} configs
2017-08-21 11:26:36 +12:00
Nick Cameron
88cb142173
Merge pull request #1895 from topecongiro/configs-match_pattern_separator_break_point
...
Add mach_pattern_separator_break_point config option
2017-08-21 09:30:34 +12:00
Michael Smith
baafa4f011
Fix wrapping of bounds in associated types
...
Bounds were wrapped to the full width of the line rather then the width
available after the "type ...: ", resulting in rustfmt unnecessarily producing
lines that were longer than the maximum width.
2017-08-19 15:30:53 -07:00
Michael Smith
1c9d044c05
Add attributes_on_same_line_as_{field,variant}
2017-08-19 15:09:10 -07:00
Seiichi Uchida
5cf05a2992
Update tests
2017-08-18 23:20:12 +09:00
Nick Cameron
c166004e6d
Merge pull request #1888 from topecongiro/no-panic-against-invalid-attr
...
Do not panic against files with invalid attributes
2017-08-16 16:28:15 +12:00
Nick Cameron
02cb9a134d
Merge pull request #1886 from topecongiro/issue-1882
...
Obey to `array_layout` when using mixed tactic for array
2017-08-16 16:27:37 +12:00
topecongiro
528200009a
Do not panic against files with invalid attributes
2017-08-16 00:11:20 +09:00
Seiichi Uchida
4fd9920a2d
Obey to array_layout when using mixed tactic for array
2017-08-15 22:10:39 +09:00
Seiichi Uchida
a1d28bf41c
Merge pull request #1872 from sinkuu/remove_newline
...
Remove blank lines at start or end of block
2017-08-15 00:28:31 +09:00
Nick Cameron
16920fb5c5
Merge pull request #1879 from topecongiro/issue-1878
...
Use correct width for subexpr_list
2017-08-14 11:10:28 +12:00
Nick Cameron
3ab3fb2215
Merge pull request #1875 from topecongiro/empty-tuple-pattern
...
Allow empty tuple pattern
2017-08-14 11:05:39 +12:00
topecongiro
10f1257eb3
Use correct width for subexpr_list
2017-08-13 10:17:52 +09:00
topecongiro
02d82f926e
Allow empty tuple pattern
2017-08-12 16:01:03 +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
sinkuu
fea3080f91
Format
2017-08-11 17:44:16 +09:00
sinkuu
b433e63d2a
Remove unnecessary blank lines at the start and the end of a block
2017-08-11 17:44:16 +09:00
topecongiro
0bb998685d
Cover comments between function args and the brace
2017-08-10 23:11:18 +09:00
Nick Cameron
7da776423a
Merge pull request #1864 from topecongiro/reorder-extern-crates
...
Reorder extern crates
2017-08-09 20:45:49 +12:00
topecongiro
c28df858c7
Format source codes and update tests
2017-08-09 00:16:35 +09:00
topecongiro
021f922b9c
Keep the pre-comment on the same line with item if it fits max width
2017-08-08 18:24:06 +09:00
Caleb Jones
fa242a5cd6
Fix #1858 - "Don't erase a use with attributes attached"
...
This prevents code like
#[cfg(unix)]
pub use self::unix::{};
from becoming
#[cfg(unix)]
which would cause the attribute to be attached to the next item.
2017-08-06 19:53:57 -04:00
topecongiro
6f24c64673
Update tests
2017-08-05 15:24:20 +09:00
Nick Cameron
c283d3e643
Merge pull request #1840 from topecongiro/match-with-max-width
...
Match with max width
2017-08-01 13:51:23 +12:00
Emilio Cobos Álvarez
27a3bdb394
visitor: Only reorder imports if at least one of them is in file-lines.
2017-07-31 09:14:58 +01:00
Emilio Cobos Álvarez
6bf9124ace
visitor: Make sure to don't eat or realign items when they should be skipped due to file-lines.
...
Before this patch, stuff like the argument with the comment was realigned to
column 0, even when being outside of the file_lines range.
2017-07-31 09:14:58 +01:00
Seiichi Uchida
36b347b123
Update tests
2017-07-31 16:24:18 +09:00
Seiichi Uchida
47456aaa43
Merge pull request #1819 from brainlessdeveloper/fix-extern-crate-whitespace
...
Remove whitespace between words in extern declarations
2017-07-31 16:21:48 +09:00
Fausto Núñez Alberro
3377ba4dd7
Remove whitespace between extern crate declaration
2017-07-29 12:03:57 +02:00
topecongiro
5aff5beb2a
More fine-grained file-lines
2017-07-29 16:11:36 +09:00
topecongiro
462530cb7e
Fix a typo in rewrite_associated_type
2017-07-28 06:27:34 +09:00
Seiichi Uchida
7c9aee78f0
Update tests
2017-07-26 22:43:50 +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
d97ecd319d
Update tests
2017-07-25 18:51:29 +09:00
topecongiro
66703e3d6c
Restore comments in file-liens tests
2017-07-25 15:47:44 +09:00
Seiichi Uchida
5c99d6c6bc
Update tests
2017-07-25 00:56:09 +09:00
topecongiro
d7a57d36e7
Update tests
2017-07-22 11:18:59 +09:00
topecongiro
3e3d3c00de
Update tests
2017-07-21 13:55:34 +09:00
topecongiro
b233653a22
Cover missing comments between attributes and expressions
2017-07-20 23:58:00 +09:00
Nick Cameron
b37e2664a6
Merge pull request #1786 from euclio/globs
...
add test for root glob imports
2017-07-13 08:15:46 +12:00
Andy Russell
320f18345b
add test for root glob imports
...
Fixes #1472 .
2017-07-12 12:53:02 -04:00
Seiichi Uchida
51641f167e
Do not count the number of parens inside str or comment
2017-07-12 17:17:41 +09:00
topecongiro
c11aac04a3
Update wrap_match_arms option tests and visual guide
2017-07-11 21:53:57 +09:00
Nick Cameron
3552595a3b
Merge pull request #1780 from topecongiro/rfc/union
...
Format union
2017-07-11 16:16:35 +12:00
Nick Cameron
4cfc2bfbd4
Merge pull request #1778 from topecongiro/rfc/match-arm-multiline-pattern
...
Rfc: fix up match arm pattern
2017-07-11 16:11:09 +12:00
Seiichi Uchida
bc90a12b8d
Format union
2017-07-10 17:26:55 +09:00
topecongiro
7cbc48ae32
Update tests
2017-07-10 16:52:55 +09:00
topecongiro
7ab4bdfd85
Use correct one line budget when rewriting index
2017-07-10 14:23:29 +09:00
topecongiro
680a3a1d19
Add tests to check alignment don't exceed max_width
2017-07-07 09:04:06 +09:00
topecongiro
a4cce31ea9
Update tests
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
8e8e7a4215
Add array_horizontal_layout_threshold option
2017-07-06 01:19:36 +09:00
topecongiro
cb48435ff3
Format source codes
2017-07-05 18:31:37 +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
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
topecongiro
2ed6feca83
Update tests
...
Now structs.rs has no overflowing max_width :)
2017-07-03 18:55:11 +09:00
topecongiro
0199e08367
Use correct one line budget in rewrite_closure_block
2017-06-28 10:56:29 +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
f062544cdd
Update tests inside macro.rs
...
I moved around some tests in order to prevent rustfmt from failing to format
tests after macro invocations whose arguments cannot be parsed as expressions.
2017-06-23 13:03:37 +09:00
topecongiro
b5a13602d9
Update tests
2017-06-20 22:35:16 +09: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
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
779f037c8d
Merge pull request #1728 from topecongiro/trailing-comma
...
Apply config.trailing_comma wherever possible
2017-06-20 12:22:58 +12:00
Sean Olson
ea1df1777b
Modify control_brace_sytle
test to ensure match
braces are formatted correctly.
2017-06-19 08:12:15 -07:00
Seiichi Uchida
b99f3cb447
Allow extending a chain after raw string literal
2017-06-19 22:06:08 +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
482675cf58
Update tests
2017-06-19 11:25:21 +09:00
Seiichi Uchida
6afb0e856c
Avoid line break when rhs of assignment is an invalid macro
2017-06-18 14:25:21 +09:00
Seiichi Uchida
4d11faff4b
Update tests
2017-06-18 02:16:27 +09:00
topecongiro
e31f5eceac
Use correct span for Infer type inside closure header
2017-06-17 15:35:29 +09:00
topecongiro
897d7bdcb9
Add a test for #1697
2017-06-17 15:26:59 +09:00
topecongiro
4a5871eccc
Use correct indentaion for vec! with semicolon
2017-06-16 13:57:37 +09:00
topecongiro
6047179ab0
Update tests
2017-06-14 00:09:17 +09: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
9ad499786d
Use block indent for args if single line args exceeds max width
2017-06-12 15:58:27 +09:00
topecongiro
e94fcfcd39
Update tests
2017-06-11 23:27:02 +09:00
topecongiro
bd80077be8
Add format_trait_ref_then_update_result
2017-06-10 21:07:38 +09:00
est31
4665943b51
Fix the pub-restricted tests
2017-06-06 07:32:07 +02:00
topecongiro
27da80324c
Implement catch
2017-06-06 07:32:06 +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
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
d7de5b7656
Allow comments after attributes on enum fields
2017-06-04 23:27:21 +09:00
Seiichi Uchida
08b5375776
Forbid trailing comma at the end of args of variadic functions
2017-06-03 15:03:08 +09:00
Nick Cameron
cdc3f9321c
Rename the Style::Default option to Legacy
2017-06-02 11:44:38 +12: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
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
Nick Cameron
9b79cb5c22
Merge pull request #1602 from topecongiro/attributes-on-expressions
...
Allow attributes on expressions
2017-05-28 18:34:50 +12:00
topecongiro
72c04facd2
Add tests for issues which can be closed on the current master
...
This PR adds tests for #325 , #1092 , #1214 , #1278 , #1329 and #1427 .
2017-05-28 13:24:05 +09: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
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
topecongiro
b6c503ac32
Allow comments after attributes of struct fields
2017-05-27 09:36:25 +09:00
topecongiro
554605d47c
Format source codes and add tests
2017-05-26 16:40:19 +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
189b6bd7bb
Update tests
2017-05-25 22:55:33 +09:00
topecongiro
986abc24b4
Add a test for #1380
2017-05-25 16:30:45 +09:00
topecongiro
c69608a7e0
Allow the last elem in chain to overflow
2017-05-25 15:50:46 +09:00
topecongiro
c8ad521c9f
Decide whether args fit in a single line inside rewrite_call_args
2017-05-25 06:10:00 +09:00
topecongiro
e3eec44690
Return original snippet when macro contains invalid syntax
2017-05-24 07:24:31 +09:00
topecongiro
f83c22f24f
Add trailing comma to a single arg in multiline
2017-05-23 13:26:59 +09:00
topecongiro
b4cd9584b3
Implement combining for tuple and block
2017-05-23 12:51:32 +09:00
topecongiro
2c15204f0c
Update tests
2017-05-23 12:51:13 +09:00
topecongiro
dc8d3aa23a
Update tests
2017-05-23 11:39:31 +09:00
topecongiro
13af774e55
Fix weird indentaion in chain
2017-05-23 11:37:12 +09:00
topecongiro
d16a0a399e
Implement 'vec![expr; expr]'
2017-05-23 11:32:09 +09:00
Ben Boeckel
8ca699ce26
config: fix suffices
-> suffixes
typo
...
Fixes #1477 .
2017-05-18 08:03:47 -04:00
Seiichi Uchida
c0fae6a82a
Merge pull request #1562 from flier/reorder_imports_in_group
...
reorder imports in group
2017-05-18 17:53:23 +09:00
Flier Lu
1077a100a1
reorder imports in group
2017-05-18 13:26:34 +08:00
topecongiro
cfff3bd91e
Use multiline when signature does not fit single line
2017-05-17 16:31:09 +09:00
Michael Killough
dcd3c0ed2e
Add test for issue #1366 .
...
As the comments in the issue state: it appears to work now, so this test
should just stop any regressions.
The second example in the issue description will format to the first,
which is then a fixed-point.
2017-05-16 16:17:46 +07:00
Seiichi Uchida
79ba34c607
Use offset_left for rewrite_unary_prefix
2017-05-15 22:55:01 +09:00
Nick Cameron
d1682b3473
Merge pull request #1510 from fintelia/better-filelines
...
Better file_lines
2017-05-15 09:19:18 +12:00
Jonathan Behrens
4d2f6a29a7
Add and improve tests of file_lines
2017-05-13 13:45:35 -04:00
Seiichi Uchida
d0a094eefb
Merge pull request #1546 from topecongiro/bug/range-full
...
Add a missing trailing comma before elipses
2017-05-13 17:40:47 +09:00
topecongiro
4aa64674c9
Add a missing trailing comma before elipses
2017-05-13 07:23:34 +09:00
Seiichi Uchida
56515dd4d6
Merge pull request #1543 from topecongiro/field-attr
...
Support struct_field_attributes
2017-05-12 20:08:36 +09:00
topecongiro
744fa427e2
Support struct_field_attributes
2017-05-12 17:58:38 +09:00
topecongiro
384ce46eef
Use vertical layout when args len is larger than fn_call_width
2017-05-12 16:30:26 +09:00
topecongiro
ba1a7b9e7f
Try multi-line only when fn_call_style is Block and rewriting function call
2017-05-12 10:33:05 +09:00
Nick Cameron
1eec103516
Merge pull request #1523 from topecongiro/poor-formatting/fn_call_style
...
Use multiline when args exceeds max_width in fn_call_style = "block"
2017-05-10 08:27:24 +12:00
topecongiro
30a8050559
Use multiline when args exceeds max_width in fn_call_style = "block"
2017-05-10 00:27:57 +09:00
topecongiro
9d96c33d59
Inherit alignment to last else
2017-05-09 17:33:45 +09:00
Nick Cameron
35e1ca73fc
Merge pull request #1519 from topecongiro/poor-formatting/if-else
...
Remove visual_indent when rewriting else block
2017-05-09 15:21:29 +12:00
topecongiro
0248e9869d
Apply closure exception to match in args
2017-05-09 08:28:05 +09:00
topecongiro
f36411c339
Remove visual_indent when rewriting else block
2017-05-09 08:11:05 +09:00
topecongiro
d062d79fb5
Use block indent when visual indent failed
2017-05-08 08:07:18 +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
2ee8e730a6
Add fallback path
2017-05-07 13:13:44 +09:00
Nick Cameron
75a13868da
Block format control flow discriminant expressions and binops
...
Fixes #1450
Adds control_style option
2017-05-05 14:37:13 +12:00
topecongiro
ca0225730f
Update tests
2017-05-05 10:22:20 +09:00
topecongiro
b48f4e03b3
Add tests for issues which can be closed on master
2017-05-04 14:32:13 +09:00
Nick Cameron
8579c1db0e
Merge pull request #1495 from topecongiro/poor-formatting/closure
...
Fix weird indentation inside closures
2017-05-04 17:15:58 +12:00
Sheng Hau
51815effbe
Format macros in trait item position
2017-05-04 00:10:03 +08:00
topecongiro
6d14ac84a4
Update tests
2017-05-03 11:30:17 +09:00
Nick Cameron
59d66c3ae8
Merge pull request #1453 from topecongiro/bug/empty-struct-with-comment
...
Handle empty tuple struct def with comment properly
2017-05-02 13:49:15 +12:00
topecongiro
93dae1a34d
Add test for empty tuple struct with comment
2017-05-02 10:21:39 +09:00
Seiichi Uchida
19599b9a01
Use block when arm exceeds max_width
2017-05-02 10:15:31 +09:00
Nick Cameron
b4794dbd9f
Fixup tests
2017-05-02 11:42:38 +12:00
Nick Cameron
5071c41cf8
Merge pull request #1471 from regexident/type_punctuation_density
...
Made `type_punctuation_density` apply too all `+` in types
2017-05-02 11:17:35 +12:00
Vincent Esche
42dbe482e3
Made type_punctuation_density
apply too all +
in types
2017-05-02 01:03:46 +02:00
Nick Cameron
4ad17b1efb
Merge pull request #1482 from regexident/configs-tests
...
Add source/target tests for each config option
2017-05-02 11:00:09 +12:00
Nick Cameron
7fb288f0b3
Merge pull request #1487 from topecongiro/issue1470
...
Use block indent when visual indent exceeds max_width
2017-05-02 10:45:23 +12:00
Nick Cameron
c546f1b396
Merge pull request #1454 from topecongiro/match
...
Format nested mathces properly.
2017-05-02 10:40:31 +12:00
Vincent Esche
16b91be3e6
Add source/target tests for each config option
2017-05-01 15:58:04 +02:00
Seiichi Uchida
c7e9bcadaa
Use block indent when visual indent exceeds max_width
2017-05-01 18:52:43 +09:00
topecongiro
9befcded8c
Add tests for visual indent struct tuple
2017-05-01 15:57:08 +09:00
topecongiro
3d2cd681ae
Use 'first_line_width'
2017-05-01 15:36:40 +09:00
Nick Cameron
5d9a35050d
Remove where_indent option
2017-05-01 16:05:38 +12:00
Stanislav Tkach
b53aeebbcf
Fix line length calculation (should be in chars, not bytes)
2017-04-19 17:49:03 +03:00
Nick Cameron
bdcb8d663e
Merge pull request #1438 from topecongiro/poor-formatting/method-chains
...
Lookup the last element of 'subexpr_list' instead of the first one
2017-04-06 21:26:13 +12:00
Nick Cameron
ee9daade35
Fix a bug with overlong function calls
2017-04-06 21:17:22 +12:00
Nick Cameron
a7183766b9
Test fallout
2017-04-06 13:06:11 +12:00
topecongiro
8d22e85e48
Lookup the last element of 'subexpr_list' instead of the first one
...
Closes #1217 , #1236 , #1389 and #1434 .
2017-04-06 09:26:25 +09:00
Ryan1729
822b266a3d
add tests that fail because of comma insertion
...
Signed-off-by: Ryan1729 <Ryan1729@gmail.com>
2017-04-03 16:15:11 -06:00
topecongiro
34b90d8716
Check existence of pre comment explicitly
...
This commit fixes #1428 .
2017-03-31 21:57:29 +09:00
Nick Cameron
4f226eb909
Merge pull request #1424 from topecongiro/long-struct
...
Split long fields in structs
2017-03-31 08:42:40 +13:00
topecongiro
3a1ffa7db7
Split long fields in structs
...
This commit splits long fields in structs.
Closes #1412 .
2017-03-30 13:37:34 +09:00
Fabian Zaiser
6ecc18c7de
Omit space before '\n' + comment ( fixes #457 )
2017-03-28 16:32:12 +02:00
Nick Cameron
5305bc8436
test fallout
2017-03-28 11:25:59 +13:00
Nick Cameron
a079b87e7c
Use a char len heuristic rather than item count for chain_one_line_max
2017-03-28 11:12:15 +13:00
Nick Cameron
8bca85c4b6
Support block indent for function calls
...
Uses the `fn_call_style` option.
Fixes #1358
2017-03-28 10:43:46 +13:00
C4K3
abca1deded
Add indent_match_arms option ( #1404 )
...
Makes it optional whether to indent arms in match expressions. Setting this
to false may be desirable for people wishing to avoid double-indents, in
that if the match arm is a block, the block will cause an extra indentation
level, and if it isn't a block but just a single line, it's still easy to
see the logic at a glance.
This style is preferred in certain other languages with switch statements,
e.g. Linux style C and the most common Java style.
2017-03-26 18:32:29 +13:00
Nick Cameron
488c0b9546
Test and source fallout
2017-03-22 09:25:26 +13:00
Nick Cameron
4bb31a7231
Block indenting for struct lit patterns
...
Now follows struct_lit_style (and most other struct_lit_ options).
Required a fair bit of refactoring and bug fixes.
Fixes #1311
2017-03-22 09:25:26 +13:00
Nick Cameron
d4c5d572c8
Unify fn_args_layout and fn_arg_indent
...
Closes #1390
2017-03-20 11:59:08 +13:00