171 Commits

Author SHA1 Message Date
Seiichi Uchida
427b4a831d Get rid of choose_first_connector() 2017-10-07 22:45: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
topecongiro
fe69dde96b Replace 'try_opt!' macro with a '?' operator 2017-10-05 20:50:19 +09:00
Seiichi Uchida
df7d2be562 Move Indent and Shape to shape.rs from lib.rs 2017-09-19 10:04:35 +09:00
topecongiro
f51261e93e Cargo fmt 2017-09-15 12:10:58 +09:00
Seiichi Uchida
4b79055a15 Apply refactoring from cargo clippy 2017-08-31 12:49:12 +09:00
Vadim Petrochenkov
6e5c6f5ba3 Use getters to access Span fields 2017-08-31 14:14:13 +12:00
topecongiro
10f1257eb3 Use correct width for subexpr_list 2017-08-13 10:17:52 +09:00
Seiichi Uchida
04a6d16c7b Avoid trial and error in rewrite_chain whenever possible 2017-08-09 16:36:41 +09:00
Seiichi Uchida
7268a50e36 Handle prefix and suffix try operators differently 2017-08-09 16:36:41 +09:00
Seiichi Uchida
de403f4f65 Use offset_left instead of shrink_left 2017-07-20 00:41:36 +09:00
topecongiro
6fd291981e Sort imports in alphabetical and consistent order 2017-07-13 18:42:14 +09:00
topecongiro
e3310a6a18 Format source codes 2017-07-11 21:53:10 +09:00
Nick Cameron
0a42648678 Merge pull request #1775 from topecongiro/rfc/patterns
RFC: patterns in condition and match arm
2017-07-10 16:22:01 +12:00
Seiichi Uchida
bc63d69c3f Format source codes 2017-07-10 02:24:59 +09:00
Nick Cameron
7333dfc95b Merge branch 'master' of https://github.com/petrochenkov/rustfmt into petrochenkov-master 2017-07-08 11:22:53 +12:00
Vadim Petrochenkov
d4c8a17665 Update rustfmt for ast::ExprKind::MethodCall changes 2017-07-07 15:52:23 +03:00
topecongiro
cb48435ff3 Format source codes 2017-07-05 18:31:37 +09:00
topecongiro
91bd1fdc86 Format source codes 2017-06-18 14:29:17 +09:00
topecongiro
3dcd3d7fb0 Combine condition and body of control flow
If the condition of control flow expressions ends with closing parens and alike,
put the opening bracket of the body on the same line with closing parens.
2017-06-18 14:27:58 +09:00
topecongiro
54233acc8e Format source codes 2017-06-17 16:56:54 +09:00
topecongiro
92634a8f69 Use correct budget for chain 2017-06-17 16:56:37 +09:00
topecongiro
53273b8547 Try overflowing the last element of chain only if it goes multi line 2017-06-17 16:54:03 +09:00
topecongiro
b048fe6b35 Format source codes 2017-06-17 15:26:59 +09:00
topecongiro
208ff15954 Format source codes 2017-06-16 08:49:49 +09:00
topecongiro
d3d31a9f75 Allow overflowing the last item of chain only if it is multi-lined
By multi-lined we mean if it has more than 3 lines.
2017-06-16 08:47:33 +09:00
Nick Cameron
18ccd0190e Rebasing 2017-06-13 14:49:47 +12:00
Nick Cameron
1f512948a0 Reformat source code using new defaults 2017-06-13 14:41:49 +12:00
est31
727963afe4 Update syntex_syntax
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
topecongiro
7250a468f9 Format source codes 2017-06-05 15:32:21 +09:00
topecongiro
0292640e14 Allow chain item to extend if the parent ends with closing parens and alike 2017-06-05 15:31:05 +09:00
topecongiro
b49269ad39 Forbid method chain to get combined if it uses multi line.
If the method chain goes multi line before the last element, disallow combining
the method chain.
2017-06-04 19:37:24 +09:00
topecongiro
fabbef2c3e Add macro to block expr 2017-06-04 19:35:29 +09:00
topecongiro
fef347cb9e Add use_block_indent method to RewriteContext 2017-06-04 19:35:29 +09:00
topecongiro
b63e3aaa83 Put a space between nested tuple field 2017-05-30 20:40:05 +09:00
topecongiro
554605d47c Format source codes and add tests 2017-05-26 16:40:19 +09:00
topecongiro
2580d7a310 Add chain_split_single_child option 2017-05-25 16:07:56 +09:00
topecongiro
c69608a7e0 Allow the last elem in chain to overflow 2017-05-25 15:50:46 +09:00
topecongiro
635fdc662a Format source codes 2017-05-25 15:50:46 +09:00
topecongiro
6aed417738 Disallow single line chain when the line exceeds the given budget 2017-05-25 15:50:46 +09:00
topecongiro
857747c9ca Consider trailing try operations when counting almost_total 2017-05-25 15:50:46 +09:00
Nick Cameron
393ba27311 Remove dependency on Itertools 2017-05-25 16:23:07 +12:00
topecongiro
92b54d6490 Add heuristic when rewriting chain with a single child
rustfmt splits chain into multiline when the length of chain exceeds
`chain_one_line_max`. However, currenly this rule only applies when the chain
has more than one child. This can lead to unexpected long chain if the parent
is long. This commit adds heuristic that if the length of parent is longer
than the half of `chain_one_line_max` we use multiline even if there is
only a single child.
2017-05-24 00:06:23 +09:00
topecongiro
cb4a6a2419 Use correct width when rewriting chain 2017-05-23 22:12:52 +09:00
topecongiro
a83d4876e7 Allow first child to stay on the same line with block parent 2017-05-23 22:12:37 +09:00
topecongiro
f2ec5a7bac Refactor source codes 2017-05-23 11:37:12 +09:00
topecongiro
13af774e55 Fix weird indentaion in chain 2017-05-23 11:37:12 +09:00
Michael Killough
c3c2e823cb Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config 2017-05-18 13:05:19 +07:00