Commit Graph

1912 Commits

Author SHA1 Message Date
topecongiro
39d85b0d41 Combine a sigle argument and a short callee 2017-11-30 15:00:32 +09:00
Seiichi Uchida
f99b775de7 Rename is_dummy to has_braces 2017-11-30 06:40:29 +09:00
Seiichi Uchida
1323abf93f Fix a typo 2017-11-30 06:13:42 +09:00
Seiichi Uchida
b5e4c99ca7 Use an explicit flag to decide on whether to add brace compensation 2017-11-30 06:12:32 +09:00
Seiichi Uchida
54f3c21a2f Fix a typo 2017-11-30 04:56:19 +09:00
Nick Cameron
566f34f2b4
Merge pull request #2205 from topecongiro/issue-2202
Print unstable option's name on warning
2017-11-30 08:44:36 +13:00
Seiichi Uchida
4cb1dccb97 Print unstable option's name on warning 2017-11-29 20:31:58 +09:00
topecongiro
8b53d7806c Cargo fmt 2017-11-29 17:37:51 +09:00
topecongiro
af663d8f62 Ignore fn_call_width when rewriting a call with a single non-call arg 2017-11-29 17:36:51 +09:00
topecongiro
94a770a777 Use correct shape when rewriting the last arg with overflowing 2017-11-29 17:32:31 +09:00
topecongiro
be19bab9de Take into account the rhs overhead when rewriting the last element of chain 2017-11-29 17:29:38 +09:00
Nick Cameron
4e04e825b5 Use the right kind of doc comment in chains.rs
cc #2185
2017-11-28 15:03:02 +13:00
Nick Cameron
3c4d260bfc
Merge pull request #2194 from topecongiro/use-cargo_metadata
Use cargo_metadata
2017-11-28 11:48:40 +13:00
topecongiro
f06cb34022 Replace TargetKind with simple String 2017-11-27 22:09:01 +09:00
topecongiro
940758b1bd Cargo fmt 2017-11-27 21:00:27 +09:00
topecongiro
dff2ebba05 Remove FIXME
now is the time
2017-11-27 20:58:39 +09:00
topecongiro
5c81741733 Minor refactoring 2017-11-27 20:57:06 +09:00
topecongiro
261d325e15 Remove width of a trailing comma on variant 2017-11-27 20:54:55 +09:00
topecongiro
a5b647faa7 Allow '--package <package>' 2017-11-27 19:29:26 +09:00
topecongiro
bf87d9b79f Rename WorkspaceHitlist to CargoFmtStrategy 2017-11-27 18:57:46 +09:00
topecongiro
fbe06c6f77 Random formatting 2017-11-27 18:48:16 +09:00
topecongiro
33ab1f4927 Use cargo_metadata crate over json crate 2017-11-27 18:47:07 +09:00
topecongiro
58e83fb426 Implement PartialEq, Eq and Hash trait for Target
and move Target::from_json() to TargetKind::from_str()
2017-11-27 18:45:26 +09:00
topecongiro
1b1122654f Add cargo_metadata to dependency 2017-11-27 18:37:21 +09:00
Nick Cameron
fcb48786c8
Merge pull request #2191 from topecongiro/issue-2190
Recover from failing to format variants even where there is no comment
2017-11-27 18:14:08 +13:00
topecongiro
d5c98008f0 Recover from failing to format variants even where there is no comment 2017-11-27 13:50:01 +09:00
Nick Cameron
f0af1d4818 Remove CompressedIfEmpty option from fn_args_density
It was identical to Tall
2017-11-27 17:49:55 +13:00
Nick Cameron
677446e99d Merge fn_empty_single_line and impl_empty_single_line into empty_item_single_line 2017-11-27 17:46:09 +13:00
Nick Cameron
9a33255834 Rename wrap_match_arms to match_arm_blocks 2017-11-27 17:35:27 +13:00
Nick Cameron
8f4d85a9d7 Merge multiline_closure_forces_block and multiline_match_arm_forces_block into force_multiline_block 2017-11-27 17:03:54 +13:00
Nick Cameron
087f8b5854 Remove match_arm_forces_newline 2017-11-27 16:31:49 +13:00
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
e6ce65b214 Put rhs on the same line as lhs if putting rhs on next line exceeds max width 2017-11-24 12:05:02 +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
e5bcb2259a Reorganise config options and stabilise a few 2017-11-24 15:41:27 +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
d00c60df5c Remove chain_split_single_child option 2017-11-24 14:12:54 +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
d92cfff43b Align post comments with items when the it starts with newline 2017-11-23 12:38:34 +09:00
topecongiro
53d7489221 Force vertical layout when we find any kind of single line comments 2017-11-23 12:37:12 +09:00
topecongiro
59ebde26f7 Cargo fmt 2017-11-21 08:52:43 +09:00
topecongiro
34b0c9cf3f Do not give up when we run out of space when choosing rhs 2017-11-21 08:52:11 +09:00
topecongiro
6710f0dc9a Do not squash unsafe block 2017-11-20 16:40:58 +09:00
Nick Cameron
f987946078
Merge pull request #2161 from topecongiro/issue-1807
Implement RFC style for match pattern
2017-11-20 14:51:53 +13:00
Nick Cameron
d230242e23
Merge pull request #2162 from utkarshkukreti/issue-1753
Fix missing trailing newline in --write-mode=diff.
2017-11-20 14:45:07 +13:00
topecongiro
448991a6f3 Handle multi-lined fn signature 2017-11-18 15:46:01 +09:00
topecongiro
d5152fc8c6 Use choose_rhs() for the layout of multi-lined struct field 2017-11-18 15:45:58 +09:00
Utkarsh Kukreti
d44d4a3fbc Add test for trailing newline in diff.
Credits to @afshinm for most of the code.
2017-11-17 20:46:17 +05:30
Utkarsh Kukreti
d0df53d833 Fix checkstyle test.
The only reason it passed before was due to a bug in the `diff` crate.
The diff was empty even though the contents of the files were different --
namely one string had a trailing newline character while the other didn't.
Now both have a trailing newline character.
2017-11-17 09:43:47 +05:30
topecongiro
95d7619e34 Use mixed layout for patterns that are all short 2017-11-16 17:43:36 +09:00
topecongiro
e09a0cc836 Add is_short_pattern() 2017-11-16 17:43:36 +09:00
topecongiro
311a3c526c Fix up write_list() to handle Mixed tactic 2017-11-16 17:43:36 +09:00
topecongiro
35466adbfe Generalize ListItems to allow a separator other than comma 2017-11-16 17:43:36 +09:00
topecongiro
34c2499029 Cargo fmt 2017-11-16 17:43:06 +09:00
topecongiro
09d54512da Break before '|' for multi-lined match arm pattern 2017-11-16 17:43:06 +09:00
topecongiro
b1a6dd6b83 Cargo fmr & update tests
Note that we are forcing vertical layout when there are attributes on top of a
variant.
2017-11-16 16:07:15 +09:00
topecongiro
8ef54293e8 Force vertical layout for all variants if one of then use multiple lines 2017-11-16 16:02:01 +09:00
topecongiro
f7ef1f681c Use rewrite_assign_rhs() when rewriting associated type 2017-11-16 11:31:09 +09:00
topecongiro
4cd2e6f39a Generalize rewrite_assign_rhs() 2017-11-16 11:26:36 +09:00
topecongiro
95c7325ac2 Do not get tricked by a nested comment 2017-11-15 15:46:00 +09:00
topecongiro
37b1779426 Look for a newline after match arm only when there is one 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
bdb8f369e8 Return None when a literal exceeds budget 2017-11-15 10:36:49 +09:00
topecongiro
bc543cce0b Combine spaces_within_parens and spaces_within_brackets 2017-11-14 23:42:31 +09:00
topecongiro
babc479783 Use space_before_colon and space_after_colon 2017-11-14 23:25:36 +09:00
Nick Cameron
6a6e9a22bc
Merge pull request #2148 from topecongiro/audit-option/brace_style
Combine fn_brace_style and item_brace_style
2017-11-14 16:57:09 +13:00
Nick Cameron
be76476421
Merge pull request #2137 from clippered/add-color-cli-option
add cli option for color
2017-11-14 15:11:31 +13:00
topecongiro
f8074b340d Combine fn_brace_style and item_brace_style 2017-11-14 10:47:02 +09:00
clippered
794a215b27 rename to use_colored_tty; used match as well 2017-11-13 20:18:05 +11:00
clippered
d2f2f25463 add cli option for color 2017-11-13 20:18:03 +11:00
topecongiro
04f09c9d85 Replace '*_indent' with 'indent_style' in src 2017-11-13 17:33:32 +09:00
Nick Cameron
4da9a147e1 Collapse multiple blocks in closures
Fixes #1524
2017-11-13 16:45:54 +13:00
Nick Cameron
bc6e493ce0 More closures refactoring 2017-11-13 16:29:43 +13:00
Nick Cameron
e6800bf27d remove closure_block_indent_threshold option 2017-11-13 15:40:54 +13:00
Nick Cameron
7ff2cb23f5
Merge pull request #2146 from topecongiro/where-on-unit-struct
Format where clause on unit struct
2017-11-13 15:28:32 +13:00
Nick Cameron
e6253c4d31 Extract a closures module 2017-11-13 15:27:16 +13:00
Nick Cameron
10bce817d9 Some basic refactoring 2017-11-13 15:13:23 +13:00
topecongiro
6b8cd40d07 Format where clause on unit struct 2017-11-13 11:07:09 +09:00
topecongiro
687b26c688 Add BracePos 2017-11-13 11:06:53 +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
f45aba9ced Cargo clippy 2017-11-13 08:02:23 +09:00
topecongiro
c485202907 Format generics on unit struct 2017-11-13 08:02:06 +09:00
Seiichi Uchida
d9e31be40f Refactor: use less vertical lines 2017-11-11 23:15:57 +09:00
Seiichi Uchida
033ce59a6a Return None when string literal from source exceeds max width 2017-11-11 23:15:33 +09:00
Seiichi Uchida
1664ebb18b Return 'None' when macro call snippet from source exceeds max width 2017-11-11 23:14:24 +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
4d28e148a5 Return None when there are comments around trait bounds 2017-11-10 21:21:53 +09:00
Seiichi Uchida
76f5bc06c4 Fix a typo 2017-11-10 21:21:06 +09:00
topecongiro
05798572bb Remove empty lines at the beginning of the file 2017-11-10 17:09:31 +09:00
topecongiro
6ce42823cb Add opt_snippet() and opt_span_after() 2017-11-10 17:08:57 +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
Seiichi Uchida
e079cb81ef Remove 'Option<_>' from return type of 'take_while_with_pred()' 2017-11-09 11:33:35 +09:00
topecongiro
119b49dad0 Cargo fmt 2017-11-08 18:24:13 +09:00
topecongiro
fd10925a08 Implement soft wrapping on doc comments 2017-11-08 18:24:03 +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
Nick Cameron
bfa093d394 Fix formatting in git-fmt 2017-11-08 21:10:47 +13:00
Nick Cameron
a3c65d7ca8
Merge pull request #2127 from topecongiro/issue-2126
Handle chain with a single long child with a small parent
2017-11-08 21:02:21 +13:00
Nick Cameron
e8bc2bf966 Tweak the uncommitted file rules for git-fmt 2017-11-08 18:17:12 +13:00
topecongiro
9337760dd9 Refactor: use less vertical lines 2017-11-08 11:53:13 +09:00
topecongiro
19a3b0b5ca Use struct prefix as a callee 2017-11-08 11:52:25 +09:00
topecongiro
30959bc16f Cargo fmt 2017-11-08 08:25:42 +09:00
topecongiro
6a31415867 Use correct shape when there is a single child 2017-11-08 08:25:23 +09:00
Nick Cameron
aafaa2fc2e Add git-fmt tool 2017-11-08 08:05:44 +13:00
topecongiro
e917eff7ba Remove unused imports 2017-11-06 21:48:18 +09:00
topecongiro
f39559fef0 Use accessors instead of destucting 2017-11-06 21:48:18 +09:00
topecongiro
d8d9fedf9e Propagate an error rather than panic 2017-11-06 21:48:18 +09:00
topecongiro
3e8f4b7907 Fix PairParts related issues 2017-11-06 21:48:05 +09:00
topecongiro
082c001843 Add visit_static() 2017-11-06 13:52:25 +09:00
topecongiro
3b2b7f67ee Add StructParts to reduce the number of args 2017-11-06 13:52:25 +09:00
topecongiro
318f9c89e0 Add StaticParts to reduce the number of args in rewrite_static() 2017-11-06 13:52:25 +09:00
topecongiro
8c6c15a096 Remove unused args from format_generics() 2017-11-06 13:52:25 +09:00
topecongiro
a3f286a0dc Remove an unused arg from visit_fn() 2017-11-06 13:52:25 +09:00
topecongiro
c73871c516 Introduce PairParts to reduce the number of args of rewrite_pair() 2017-11-06 13:52:25 +09:00
topecongiro
10cb568c18 Remove redundant references 2017-11-06 13:52:25 +09:00
topecongiro
feeca8a724 Remove unnecessary format!() call 2017-11-06 13:52:25 +09:00
topecongiro
4e1a75a429 Collapse if-else 2017-11-06 13:52:25 +09:00
topecongiro
b023cc831c Remove static lifetime 2017-11-06 13:52:25 +09:00
topecongiro
fc4a51a242 Prefer println!() to println!("") 2017-11-06 13:52:25 +09:00
topecongiro
79c6f632ef Remove an unnecessary lifetime 2017-11-06 13:52:25 +09:00
topecongiro
39ca7db7c8 Remove unnecessary String::from() 2017-11-06 13:52:25 +09:00
topecongiro
d66161c6a3 Prefer &[T] to &Vec<T> 2017-11-06 13:52:25 +09:00
topecongiro
1a9d00bbef Prefer ends_with() to chars().last().unwrap() 2017-11-06 13:52:25 +09:00
topecongiro
f2eebb0e62 Prefer unreachable! to panic! 2017-11-06 13:52:25 +09:00
topecongiro
c7a788084b Simplify let-if pattern 2017-11-06 13:52:25 +09:00
topecongiro
6c5ac5a9b3 Remove needless borrows 2017-11-06 13:52:25 +09:00
topecongiro
314c97387d Squash redundant match arms 2017-11-06 13:52:25 +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
Nick Cameron
0b481ceced
Merge pull request #2113 from topecongiro/issue-2110
Use correct span for tuple struct's body
2017-11-06 08:21:56 +13:00
Pascal Hertleif
536526685d Fix compile on 2017-11-04 nightly
Breakage came from https://github.com/rust-lang/rust/pull/45247/
2017-11-05 12:26:06 +01:00
Seiichi Uchida
1e4c2fb713
Merge pull request #2117 from adeschamps/issue-2103
Handle case where there is a where clause but no generic parameters.
2017-11-05 05:27:36 +09:00
Anthony Deschamps
18ac341413 Handle case where there is a where clause but no generic parameters.
Fixes #2103
2017-11-04 15:25:09 -04: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
d287b06eba Rename 'chain_one_line_max' to 'chain_width' 2017-11-04 22:24:43 +09:00
topecongiro
16302d3578 Use get_bytepos_after_visibility() 2017-11-03 23:53:38 +09:00
topecongiro
3973cdd0a8 Use correct span for tuple struct's body 2017-11-03 23:53:07 +09:00
topecongiro
84526ab87e Add get_bytepos_after_visibility() 2017-11-03 23:51:19 +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
bfaeac202a Add a comment on args_have_many_closure() 2017-11-03 08:57:38 +09:00
Nick Cameron
9bf81f9d12 Remove LicensePolicy (dead code)
Fixes #1320
2017-11-03 08:43:33 +13:00
topecongiro
b17de6228f Cargo fmt 2017-11-02 21:45:00 +09:00
topecongiro
960fec898b Force to use block for closure's body when there is only a single control expr 2017-11-02 21:43:33 +09:00
topecongiro
e4f13dfdd6 Use is_unsafe_block() 2017-11-02 21:42:11 +09:00
topecongiro
81cd12cc08 Add args_have_many_closure() 2017-11-02 21:41:46 +09:00
topecongiro
87afdf4467 Combine PatKind::TupleStruct 2017-11-02 20:29:10 +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
Nick Cameron
be959667c1
Merge pull request #2106 from clippered/fix-panic-on-windows-stderr
fix output panics on unable to write to stderr
2017-11-02 15:04:59 +13:00
clippered
3bae42aa5a fix output panics on unable to write to stderr 2017-11-01 23:45:35 +11:00
Martin Lindhe
f930a16b8d fix some typos 2017-11-01 07:33:55 +01:00
topecongiro
471e9110f5 Add ftp and file protocols 2017-11-01 12:35:32 +09:00
topecongiro
dae76d21ff Implement soft wrapping for comments 2017-10-31 15:07:58 +09:00
topecongiro
38399875b8 Add has_url() 2017-10-31 15:07:19 +09:00
topecongiro
bc31014423 Add an optional max width argument to rewrite_string() 2017-10-31 15:04:50 +09:00
topecongiro
7e99893e25 Use visual indent only when rewriting string literal 2017-10-31 15:03:46 +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
b0d6d03a25 Use correct budget 2017-10-30 23:38:05 +09:00
Seiichi Uchida
2e06dea146 Format match expr with empty body 2017-10-30 23:37:26 +09:00
Seiichi Uchida
e84e01c442 Use context.budget() 2017-10-30 23:37:26 +09:00
Seiichi Uchida
fe39c0cd8c Fix a typo 2017-10-30 23:34:44 +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
cf0d494dda
Merge pull request #1998 from tmahmood/master
Implemented 'unstable options' command line option
2017-10-30 07:50:28 +13:00
Nick Cameron
96566276e3 Fix build
Fixes #2096
2017-10-30 07:39:28 +13:00
topecongiro
5e30a0183f Filter packages only when '-p' was passed 2017-10-29 00:13:37 +09:00
topecongiro
98eb7da0d5 Format dependency crates only when '--all' was passed 2017-10-29 00:12:28 +09:00
Tarin Mahmood
685c9d332f Unstable options added 2017-10-28 16:26:33 +06:00
topecongiro
b0c7201c0e Do not propagate io error when dependencies are not found 2017-10-28 16:40:18 +09:00
Nick Cameron
5233f9cde0 Add support for crate shorthand for pub(crate) 2017-10-28 18:41:58 +13:00
Nick Cameron
e2a5c78e4b
Merge pull request #2043 from sunjay/lift_generics
Lifted generics to account for changes in rust-lang/rust#44766
2017-10-28 18:14:13 +13:00
Nick Cameron
4022b094f8
Merge pull request #2074 from GuillaumeGomez/emitter
Update to last Emitter update
2017-10-28 18:12:46 +13:00
Chris Emerson
92e374e778 Fix a "variable does not need to be mutable" warning. 2017-10-27 22:57:32 +01:00
Nick Cameron
2adf7eecc9
Merge pull request #2091 from topecongiro/issue-2056
Add local dependencies to targets
2017-10-28 08:32:47 +13:00
topecongiro
d10df70138 Remove iter() in for loop 2017-10-28 01:39:01 +09:00
topecongiro
3b0d2c1426 %s/std::io/io/g 2017-10-28 01:38:28 +09:00
topecongiro
bdcd19d294 Read local dependencies from cargo metadata 2017-10-28 01:38:04 +09:00
topecongiro
8d86b0eaf8 Do not use 'cargo manifest' anymore as it is deprecated 2017-10-28 01:35:32 +09: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
fa7d8de29f Only read the trailing comma of outermost fn call 2017-10-27 16:41:31 +09:00
topecongiro
ab81011a5b Force to use block for body of closure when it contains comment 2017-10-27 15:41:42 +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
adbe98e522 Merge pull request #2069 from SingingTree/log_path_str_if_after_file_errors
Return a more verbose error when formatting a file fails
2017-10-27 01:39:43 +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
Nick Cameron
73b079d3f6 Merge pull request #2079 from SingingTree/issue-1979-errors-go-to-stdout
Use stderr for various errors and warnings.
2017-10-27 01:02:44 +05:30
Nick Cameron
36ed1566ea Merge pull request #2072 from matthew-mcallister/mod-inner-skip
Handle `#![rustfmt_skip]` in more places
2017-10-27 00:55:48 +05:30
Nick Cameron
985aa2b884 Merge pull request #2070 from jugglerchris/diff_zero_context
Fix make_diff with zero context requested
2017-10-27 00:39:21 +05:30
Ömer Sinan Ağacan
abf8f43233 Implement match_arm_forces_newline option (#2039) 2017-10-26 20:20:36 +03:00
Bryce Van Dyk
adac9fb43c Use stderr for various errors and warnings.
Adjusts several error and warning report cases to output using eprintln!
instead of println! so that messages are sent to stderr.
2017-10-25 22:18:19 +13: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
Douglas Anderson
ac33472d36 Fix typo in --config-help "funciton" -> "function" 2017-10-22 00:47:45 -06:00
Guillaume Gomez
e35e27659d Update to last Emitter update 2017-10-20 17:02:49 +02:00
Matthew McAllister
1853d02ea9 Handle #![rustfmt_skip] in block statements 2017-10-20 02:37:52 -07:00
Matthew McAllister
108e2cd776 Handle #![rustfmt_skip] at file top level 2017-10-20 00:22:23 -07:00
Nick Cameron
9754bcb535 Merge pull request #2048 from japaric/required-version
add `required-version` option to rustfmt.toml
2017-10-20 11:23:27 +05:30
Bryce Van Dyk
47a0bef91c Return a more verbose error when formatting a file fails
Expands the error message returned if the after_file function fails to
also include path_str. This allows users to better identify files that are
not being formatted.
2017-10-20 15:27:35 +13:00
Chris Emerson
2a84352d1d Run rustfmt on the new changes. 2017-10-19 23:32:27 +01:00
Chris Emerson
f9bcb58eb3 Add a couple of special cases which fix the zero-context diff case. 2017-10-19 23:14:20 +01:00
Chris Emerson
6c1c81bbce Add a test for two nearby chunks (with context). 2017-10-19 23:03:27 +01:00
Chris Emerson
6282c970cf Add a failing test of zero context. 2017-10-19 20:55:20 +01:00
Chris Emerson
88f02975a1 Add a simple passing test for diffs. 2017-10-19 20:50:55 +01:00
topecongiro
0d359eacd7 Cargo fmt 2017-10-18 22:23:25 +09:00
topecongiro
142fc45dbb Take the width of trailing '?'s into account 2017-10-18 22:23:25 +09:00
topecongiro
ad47a71012 Do not distinguish between a single-child chain from others
`last_shape` is used when rewriting the last child on its own line.
2017-10-18 22:23:25 +09:00
topecongiro
51d230ead3 Use trimmed_last_line_width() 2017-10-18 22:23:25 +09:00
Sunjay Varma
3f11c4b93a Updated rustfmt to account for changes from rust-lang/rust#44766 2017-10-17 15:37:07 -04:00
Nick Cameron
560b054147 Merge pull request #2064 from topecongiro/issue-2063
Take width of return type into account for body shape of closure
2017-10-17 15:10:54 +05:30
Seiichi Uchida
043ddf146d Fix a typo 2017-10-17 11:13:20 +09:00
Seiichi Uchida
2bf4747c47 Take width of return type into account 2017-10-17 00:10:19 +09:00
Tamir Duberstein
f00c556263
correct --dump-default-config usage string 2017-10-14 08:08:52 -04:00
Nick Cameron
23be63fbba Merge pull request #2047 from japaric/dump-default-config-2
output --dump-default-config to stdout if no path is given
2017-10-13 22:06:15 +08:00
Nick Cameron
fc15e9f838 Merge pull request #2042 from topecongiro/refactoring
Refactorings
2017-10-13 22:00:10 +08: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
Seiichi Uchida
0950502151 Merge pull request #2051 from petrochenkov/dyn
Fix breakage from `dyn Trait`
2017-10-13 19:18:05 +09:00
Jorge Aparicio
77584e507c default required-version to the current rustfmt version 2017-10-10 22:37:47 +02:00
Jorge Aparicio
d2bf5b8068 run cargo fmt 2017-10-10 22:36:41 +02:00
Vadim Petrochenkov
16a478368c Fix breakage from dyn Trait 2017-10-10 21:20:57 +03:00
Jorge Aparicio
0c36c59175 add required-version option to rustfmt.toml
This option specifies the rustfmt version that *must* be used to format the code. Trying to use a
different version raises an error.

closes #1505
2017-10-09 23:07:53 +02:00
Jorge Aparicio
a1cfacdb12 output --dump-default-config to stdout if no path is given
closes #1988
2017-10-09 21:10:20 +02:00
Seiichi Uchida
c7250d18b1 Fix a typo 2017-10-09 22:44:00 +09:00
Seiichi Uchida
530a845d2f Simplify multiline case in rewrite_struct_field() 2017-10-08 22:36:03 +09:00
Seiichi Uchida
55fc5b5ec2 Get rid of rewrite_struct_field_type() 2017-10-08 22:35:45 +09:00
Seiichi Uchida
eb8566f3ee Run cargo fmt
rustfmt removes trailing comma from a function call. This could be a bug.
2017-10-07 22:45:33 +09:00
Seiichi Uchida
923a7bc1d9 Update doc comments in chains.rs 2017-10-07 22:45:33 +09:00
Seiichi Uchida
7359d3ad34 Simplify join_rewrites() 2017-10-07 22:45:33 +09:00
Seiichi Uchida
427b4a831d Get rid of choose_first_connector() 2017-10-07 22:45:33 +09:00
Seiichi Uchida
1097a431bf Change return type of Indent::to_string() to Cow<'static, str> 2017-10-07 22:45:33 +09:00
Seiichi Uchida
ed7ceebfe0 Faster last_line_extendable() 2017-10-07 22:45:33 +09:00
Seiichi Uchida
d38b3acee1 Simplify wrap_str() 2017-10-07 22:45:33 +09:00
Seiichi Uchida
c046a261a8 Change the signature of wrap_str() 2017-10-07 22:45:27 +09:00
Seiichi Uchida
dd5ed53930 Remove calling rewrite() against String 2017-10-07 22:01:44 +09:00
Seiichi Uchida
dde0cdabe0 Remove String::rewrite() 2017-10-07 21:59:33 +09:00
Seiichi Uchida
2b6e50436c Run wrap_str() only when chain_indent is set to "Visual" 2017-10-07 21:55:04 +09:00
Seiichi Uchida
02ef2ee8de Fix a typo 2017-10-07 21:48:45 +09:00
Seiichi Uchida
35cd72d989 Use correct budget for the last child of chain 2017-10-07 21:48:05 +09:00
Nick Cameron
802df67c2f Merge pull request #2035 from topecongiro/deprecate-try_opt!
Replace `try_opt!` macro with a `?` operator
2017-10-05 20:45:52 +08:00
Nick Cameron
99f14a87ae Merge pull request #2029 from wada314/fix-crlf
Fix broken tests under CRLF environment.
2017-10-05 20:07:29 +08:00