Commit graph

411 commits

Author SHA1 Message Date
Nick Cameron
a9c3108c9c Change defaults and update tests and source
New defaults are `Tabbed` for `chain_indent` and `chain_base_indent`, and `5` for `closure_block_indent_threshold`.
2016-04-22 19:18:48 +12:00
Nick Cameron
9761cf71d8 Tests 2016-04-22 18:53:39 +12:00
mrBliss
b0755581ca Format visibility of associated consts (#953)
Fixes #951.
2016-04-19 20:19:14 +02:00
Marcus Klaas
f364a7ec43 Add option to force explicit extern ABI's 2016-04-18 18:39:40 +02:00
Thia Wyrod
d773cc5327
Added loop/match brace style control option
This adds Allman style loop/match braces as an alternative to the current
default style.
2016-04-17 14:52:04 -06:00
Thia Wyrod
5bd6036218
Added option to configure if/else brace style 2016-04-17 14:48:51 -06:00
Marcus Klaas
63f0fc9641 Fix off-by-one error in pattern formatting 2016-04-16 22:42:52 +02:00
Nick Cameron
41e037da7e Merge pull request #941 from marcusklaas/type-ascription
Format type ascription
2016-04-16 16:42:56 +12:00
Marcus Klaas
d98e22c971 Check length of break and continue expressions 2016-04-15 18:11:29 +02:00
Marcus Klaas
45a83d18cc Format type ascription 2016-04-15 17:56:43 +02:00
Nick Cameron
7a758ea20a Fix closures again (#937)
* Fix closures again

Closes #934

Oh god, the rules for parsing closures are even more messed up than I thought - whether or not there is an inner block or depends not only on if there are braces, but also if there is a return type for the closure (!) and if there are statements in the block.

* Fix overflow
2016-04-15 10:52:08 +02:00
Nick Cameron
e1d33df302 Merge pull request #923 from matklad/proper-exit-code
return non-zero exit code if there are errors
2016-04-15 13:50:10 +12:00
Aleksey Kladov
77350e49b5 return non-zero exit code if there were errors 2016-04-15 02:51:50 +03:00
Nick Cameron
7bda8659ec Merge pull request #935 from marcusklaas/issue-770
Add regression test for issue 770
2016-04-15 08:13:26 +12:00
Marcus Klaas de Vries
320df84e96 Fix brace indentation for impl items (#927) 2016-04-14 20:42:38 +02:00
Marcus Klaas
ba9d64aba5 Add regression test for issue 770 2016-04-14 20:41:23 +02:00
Nick Cameron
c7780fdfd8 Be careful about where we change braces in closures
And some general refactoring of closure code.

Fixes #863
2016-04-14 09:05:42 +12:00
Nick Cameron
09440b55ef Merge pull request #921 from matklad/more-unification
unify format_string and format_file
2016-04-12 11:05:06 +12:00
Nick Cameron
eadc878de0 Handle variadic function types
Closes #842
2016-04-12 10:47:35 +12:00
Nick Cameron
2f5f0a454a Merge pull request #912 from rust-lang-nursery/pat-simple-mixed
Change the logic around breaking multiple patterns in match arms
2016-04-12 10:47:08 +12:00
Nick Cameron
ce97bc08be Merge pull request #896 from erikjohnston/fn_arg_one_line
Add fn_arg_one_line option
2016-04-12 10:44:01 +12:00
Nick Cameron
5dc3283e49 Reviewer comments - mostly fix rewrite_guard 2016-04-12 10:30:57 +12:00
Nick Cameron
afc8be1d79 Change the logic around breaking multiple patterns in match arms
Refactor to use the list code, don't preserve original stacking-ness, base vertical vs mixed formatting on complexity of the patterns.

Closes #386
2016-04-12 09:23:37 +12:00
Aleksey Kladov
dc1fc4be0f unify format_string and format_file 2016-04-11 22:56:54 +03:00
Nick Cameron
492b26cf04 Empty structs and struct lits (#920)
* Handle empty struct lits

Closes #835

* Don't crash on empty struct defs.

Not a great fix, but better than crashing.
2016-04-11 21:05:54 +02:00
Nick Cameron
7ac354fd09 Don't be so aggressie about line-breaking strings (#911)
We will no longer break in the middle of words, only at whitespace or punctuation.

This means we sometimes over-run, but that seems better than some of the bad splits we see.

Closes #369
2016-04-11 20:45:47 +02:00
Nick Cameron
19849fea15 Update the world 2016-04-08 15:51:06 +12:00
Erik Johnston
4c9dd747bf Fix long generic indent 2016-04-07 20:29:05 +01:00
Erik Johnston
4edc6f1a4e Add variant to fn_args_layout 2016-04-07 20:01:16 +01:00
Erik Johnston
615848339b Merge branch 'master' of github.com:nrc/rustfmt into fn_arg_one_line 2016-04-07 19:53:19 +01:00
Aleksey Kladov
07cf62fc42 simplify tests
* change layout so that test group `foo` has source files in
`test/foo/source` and target files in `test/foo/target`.

* use significant comments to specify write mode instead of threading
  Option<WriteMode>
2016-04-05 02:45:39 +03:00
Aleksey Kladov
ac4532e161 use format_input function in tests 2016-04-03 00:32:24 +03:00
Aleksey Kladov
255231d9ed don't read config twice during tests 2016-04-02 23:41:25 +03:00
Erik Johnston
57847e451a Add fn_arg_one_line option
If set, arguments will be kept on one line if they fit. Currently only
applies when `fn_args_layout` is set to `Block`.

This commit also fixes a bug where newlines were inserted inbetween
argument brackets when there were no arguments and `fn_args_layout` was
set to `Block`.
2016-04-02 00:25:35 +01:00
Erik Johnston
8219d15291 Fix incorrect indent with fn_args_layout: Block
The closing parenthesis for the arg list was written on a new line
without first applying the appropriate indent.
2016-04-01 23:01:49 +01:00
Nick Cameron
5b11d2e80f Merge pull request #892 from marcusklaas/closed-ranges
Format closed ranges
2016-03-31 13:47:09 +13:00
Marcus Klaas de Vries
50820c6a43 Merge pull request #883 from marcusklaas/macro-with-name
Properly format macro's with an extra ident
2016-03-30 02:03:28 +02:00
Marcus Klaas
9eee93306a Format closed ranges 2016-03-29 23:58:45 +02:00
Marcus Klaas
9e5c0390a0 Properly format macro's with an extra ident 2016-03-29 23:16:40 +02:00
Nick Cameron
cfc9f70116 Merge pull request #885 from marcusklaas/empty-trait-type-params
Remove trailing whitespace for fn types /w non-unit return
2016-03-29 08:17:52 +13:00
Nick Cameron
7d66861b82 Merge pull request #882 from marcusklaas/empty-makro-issues
Fix issues with empty macros with curly braces
2016-03-29 08:14:27 +13:00
Marcus Klaas
0142191e51 Remove trailing whitespace for fn types /w non-unit return 2016-03-27 20:40:23 +02:00
Marcus Klaas
0e0cf976c9 Fix issues with empty macros with curly braces 2016-03-27 13:44:40 +02:00
Marcus Klaas
03bf1ceeb9 Fix tuple destructuring in impl fns 2016-03-27 13:07:28 +02:00
Marcus Klaas de Vries
8fd95df54a Merge pull request #868 from rust-lang-nursery/tuple-wide
Don't apply the function args heuristic to tuple lits.
2016-03-24 14:57:24 +01:00
Marcus Klaas de Vries
ca757183fe Merge pull request #864 from Venti-/fn-density
Add option for vertical function argument list
2016-03-22 10:14:04 +01:00
Marcus Klaas de Vries
6f2bb908bb Merge pull request #866 from rust-lang-nursery/empty-extern
Keep empty extern blocks on one line
2016-03-16 18:06:25 +01:00
Connor Brewster
0a665aaceb Fixed nitpicks
Removed unneeded comment
Commented line wrapping conditions
Removed prefix param on `rewrite_associated_type`
Merged `rewrite_associated_static` into `rewrite_static`
Added extra tests
2016-03-15 14:08:12 -06:00
Connor Brewster
54a9f0ebd0 Readded spaces to source test 2016-03-14 20:11:39 -06:00
Connor Brewster
2793b4090c Added tests 2016-03-14 20:05:20 -06:00