Commit Graph

527 Commits

Author SHA1 Message Date
topecongiro
261d325e15 Remove width of a trailing comma on variant 2017-11-27 20:54:55 +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
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
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
dd1fbca99a Replace various small width heuristics with a single option
Closes #1984
2017-11-24 20:17:06 +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
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
topecongiro
59ebde26f7 Cargo fmt 2017-11-21 08:52:43 +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
topecongiro
d5152fc8c6 Use choose_rhs() for the layout of multi-lined struct field 2017-11-18 15:45:58 +09:00
topecongiro
35466adbfe Generalize ListItems to allow a separator other than comma 2017-11-16 17:43:36 +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
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
topecongiro
f8074b340d Combine fn_brace_style and item_brace_style 2017-11-14 10:47:02 +09:00
topecongiro
04f09c9d85 Replace '*_indent' with 'indent_style' in src 2017-11-13 17:33:32 +09: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
topecongiro
c485202907 Format generics on unit struct 2017-11-13 08:02:06 +09: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
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
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
f39559fef0 Use accessors instead of destucting 2017-11-06 21:48:18 +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
4e1a75a429 Collapse if-else 2017-11-06 13:52:25 +09:00
topecongiro
39ca7db7c8 Remove unnecessary String::from() 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
6c5ac5a9b3 Remove needless borrows 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
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
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
55c2000d94 Rename 'fn_args_layout' to 'fn_args_indent' 2017-11-04 22:45:47 +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
Seiichi Uchida
b0d6d03a25 Use correct budget 2017-10-30 23:38:05 +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
96566276e3 Fix build
Fixes #2096
2017-10-30 07:39:28 +13: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
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
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
topecongiro
0d359eacd7 Cargo fmt 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
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
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
topecongiro
fe69dde96b Replace 'try_opt!' macro with a '?' operator 2017-10-05 20:50:19 +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
Shohei Wada
25d2671c55 Fix broken tests under CRLF env. 2017-10-05 00:23:17 +09:00
Nick Cameron
c31c24de36 Merge pull request #2014 from topecongiro/fn-sig
Reduce number of arguments in rewrite_fn()
2017-10-04 20:18:02 +08:00
Nick Cameron
2aa2d4ebe3 Merge pull request #2011 from topecongiro/rewrite_call_inner
Change return type of rewrite_call_inner() to Option<String>
2017-10-04 20:14:10 +08:00
Seiichi Uchida
eebad40932 Use a correct budget for where predicate 2017-10-02 00:04:48 +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
topecongiro
921e0c22ab Factor out FnSig::to_str() 2017-09-29 15:09:13 +09:00
topecongiro
62e38860b9 Handle 'extern "Rust"' in format_abi() 2017-09-29 15:08:48 +09:00
topecongiro
9537437e52 Use is_empty_block() 2017-09-29 12:51:06 +09:00
topecongiro
d8fc9ec05e Remove has_braces from argument 2017-09-29 12:50:35 +09:00
topecongiro
2e6825cc8c Use FnSig in rewrite_fn() and rewrite_fn_base() 2017-09-29 12:49:39 +09:00
topecongiro
7d448c2b26 Implement FnSig type 2017-09-29 12:45:42 +09:00
topecongiro
ee2b3b1529 Put the opening brace of fn body on the next line if it exceeds max width 2017-09-28 20:12:04 +09:00
topecongiro
436a083fce Change return type of rewrite_call_inner() to Option<String> 2017-09-28 16:33:30 +09:00
topecongiro
dd0dcdf1ac Fix a budget bug in Arg::rewrite() 2017-09-26 11:20:47 +09:00
topecongiro
b751030640 Remove unnecessary wrap_str() 2017-09-19 11:40:20 +09:00
Seiichi Uchida
32fa51a6a9 Move Spanned to spanned.rs from lib.rs 2017-09-19 10:04:35 +09:00
Seiichi Uchida
df7d2be562 Move Indent and Shape to shape.rs from lib.rs 2017-09-19 10:04:35 +09:00
Seiichi Uchida
18cd19673d Remove wrap_str() from recover_comment_removed()
since we will be using the original snippet no matter what.
2017-09-18 23:30:59 +09:00
Nick Cameron
cccb7f681e Merge pull request #1966 from topecongiro/string-to-cow
Refactoring: use Cow and etc.
2017-09-18 12:45:25 +12:00
topecongiro
0b5d524486 Remove unnecessary references 2017-09-15 17:09:30 +09:00
topecongiro
f51261e93e Cargo fmt 2017-09-15 12:10:58 +09:00
Seiichi Uchida
e6e696f7b0 Avoid cloning String 2017-09-05 01:04:08 +09:00
Nick Cameron
d08405eed6 Merge pull request #1931 from topecongiro/cargo-clippy
Apply refactoring from cargo clippy
2017-08-31 17:18:45 +12:00
Seiichi Uchida
4b79055a15 Apply refactoring from cargo clippy 2017-08-31 12:49:12 +09:00
topecongiro
4ad81d0bd9 Refactoring: use context.budget() 2017-08-31 12:44:40 +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
Nick Cameron
39a91ba292 Fixup warnings and test formatting 2017-08-31 14:20:47 +12: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
topecongiro
e31a48b4d9 Refactoring: remove duplicates 2017-08-30 19:26:45 +09:00
Nick Cameron
7298ce9d52 Merge pull request #1925 from topecongiro/enhance-comment
Enhance comment formatting
2017-08-28 09:33:08 +12:00
topecongiro
1015dd8860 Use String::with_capacity() instead of String::new() 2017-08-28 00:24:10 +09:00
topecongiro
c4c55285da Recover comments between 'trait' and the opening brace 2017-08-28 00:17:19 +09:00
topecongiro
fa7c4d5030 Recover comments between 'impl' and the opening brace 2017-08-28 00:16:54 +09:00
topecongiro
6bbc6b54de Refactor - remove duplicates
replacing some functions with recover_missing_comments() and
rewrite_missing_comments().
2017-08-28 00:13:42 +09:00
topecongiro
ef84319e47 Fix a typo in calculating overhead for fn args 2017-08-27 14:57:21 +09:00