Commit Graph

809 Commits

Author SHA1 Message Date
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
Nick Cameron
21ff1d43ba Unify a bunch of option types into IndentStyle 2017-03-20 11:46:39 +13:00
Nick Cameron
c986e895bb Remove FnArgLayoutStyle::BlockAlways 2017-03-20 11:35:53 +13:00
Nick Cameron
ce7b0aacd0 Remove BlockIndentStyle::Inherit 2017-03-20 11:23:44 +13:00
Nick Cameron
0cb6f56647 Block formatting for arrays
Fixes #1331
2017-03-20 10:26:19 +13:00
Nick Cameron
70085fca84 Try harder to format function sigs
Fixes #1363
2017-03-10 09:26:14 +13:00
Nick Cameron
e3aad6ee83 Be smarter about finding the span for .. in patterns
Fixes #1319
2017-03-09 15:49:58 +13:00
Nick Cameron
6025492245 Implement where_style Rfc 2017-03-09 14:21:20 +13:00
Nick Cameron
e7489356c6 Format glob imports
Fixes #1356
2017-03-08 10:12:42 +13:00
Nick Cameron
f2eac0513f Fix trailing comma tests 2017-03-02 14:27:33 +13:00
Nick Cameron
248f2aba56 Merge branch 'master' of github.com:rust-lang-nursery/rustfmt 2017-03-02 14:27:02 +13:00
Marcus Ball
b8da53ad78 Fix wrap_match_arms resulting in a missing comma (#1307)
* Fix match arms missing comma with "wrap_match_arms = false"

* remove assert; use body_suffix for comma

* basic test case for issue 1127
2017-03-01 09:46:10 +13:00