Commit Graph

1525 Commits

Author SHA1 Message Date
Nick Cameron
c696dcf8da Handle attributes on modules (#968)
* Handle attributes (including doc comments) on inline modules

Closes #22
Closes #684

* Tweak the rules for changing indentation in comments (to do it less often).
2016-05-02 10:54:25 +02:00
Kamal Marhubi
6285d53885 Handle new visibility types more gracefully 2016-05-02 01:05:23 -04:00
Kamal Marhubi
fd38acb86f deps: Update syntex_syntax to 0.31.0
Most of the churn on this bump comes from the `Visibility` enum changing
from

    pub enum Visibility {
        Public,
        Inherited,
    }

to

    pub enum Visibility {
        Public,
        Crate,
        Restricted { path: P<Path>, id: NodeId },
        Inherited,
    }

which require taking `Visibility` by reference in most places. The new
variants are not handled at this point.

Refs #970
2016-05-01 23:06:58 -04:00
Nick Cameron
5092eec081 Merge pull request #966 from MicahChalmer/skip-children-in-plain-write-mode
Always skip children when using Plain write mode
2016-04-28 18:15:22 +12:00
Micah Chalmer
70611bf9ac Always skip children when using Plain write mode
Outputting child module contents in the "Plain" write mode does not make
sense, since there is no way to differentiate code that came from a
child module from that which came from the parent file.
2016-04-28 01:44:45 -04:00
Nick Cameron
de2b8d98ea Merge pull request #960 from rust-lang-nursery/big-closures
Block indent large closures and field/method chains
2016-04-28 09:49:08 +12:00
Nick Cameron
fcd2021583 Add visual indent tests for chains 2016-04-28 08:08:54 +12:00
Nick Cameron
9188ec0f7f Bail out on recovered errors. (#965)
Closes #915
Closes #930
Closes #931
2016-04-27 21:08:44 +02:00
Nick Cameron
f2105d382f Fix for stable 2016-04-26 14:27:13 +12:00
Nick Cameron
19fa5c9ebb Update docs (and a function name) 2016-04-22 19:26:42 +12:00
Nick Cameron
95cc135bac Add a bootstrap script for running rustfmt on itself. 2016-04-22 19:19:09 +12:00
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
Nick Cameron
95ff52f06f Tabbed/Inherit indent for chains works even without a newline after first item. 2016-04-22 18:41:38 +12:00
Nick Cameron
3d46532e72 refactor and document the chain reformatting code 2016-04-22 14:47:00 +12:00
Nick Cameron
4c3228530f block indent large closures
somewhat rough around the edges
2016-04-22 11:29:01 +12:00
mrBliss
b0755581ca Format visibility of associated consts (#953)
Fixes #951.
2016-04-19 20:19:14 +02:00
Nick Cameron
75aeca4d39 Merge pull request #950 from marcusklaas/extern-abi
Add option to force explicit extern ABI's
2016-04-19 07:44:25 +12:00
Marcus Klaas
f364a7ec43 Add option to force explicit extern ABI's 2016-04-18 18:39:40 +02:00
Marcus Klaas de Vries
68f04cec37 Merge pull request #948 from flutterhash/master
Added option to configure if/else brace style
2016-04-17 23:15:37 +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
Nick Cameron
fe993dbdf3 Merge pull request #947 from marcusklaas/match-pattern-limit
Fix off-by-one error in pattern formatting
2016-04-17 10:23:48 +12:00
Marcus Klaas
63f0fc9641 Fix off-by-one error in pattern formatting 2016-04-16 22:42:52 +02:00
Kamal Marhubi
27c91ee35b rustfmt: Parse options once instead of once per file argument (#944)
`update_config()` was parsing the `write-mode` option once for each file
argument. This commit parses them once up front into a `CliOptions`
struct, which is then applied to the config before calling `run()`.
2016-04-16 22:34:15 +02:00
Nick Cameron
41e037da7e Merge pull request #941 from marcusklaas/type-ascription
Format type ascription
2016-04-16 16:42:56 +12:00
Nick Cameron
f70d306b83 Merge pull request #942 from marcusklaas/break-continue-fix
Check length of break and continue expressions
2016-04-16 16:42:17 +12:00
Nick Cameron
ebebe96aab Merge pull request #938 from kamalmarhubi/rename-doc-hint
config: Rename get_variant_names to doc_hint
2016-04-16 16:41:21 +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
Aleksey Kladov
847bad603e Don't print empty lines to stderr (#940) 2016-04-15 16:52:21 +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
Kamal Marhubi
a2426a678d config: Rename get_variant_names to doc_hint
The `ConfigType` trait is implemented for non-enum types, so the name no
longer makes perfect sense.
2016-04-15 01:11:04 -04: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
5adc453f23 Merge pull request #936 from marcusklaas/licenses
Add license stuff
2016-04-15 08:13:55 +12: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
6e158e4690 Add license stuff 2016-04-14 20:48:21 +02: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
3cc24c6a1a Merge pull request #928 from matklad/patch-1
don't silence error unnecessary
2016-04-14 11:42:25 +12:00
Aleksey Kladov
b1efb3a39e don't silence error unnecessary
This `if` was used to separate error output from the formatting output, when they both used stdout. It was useful for integration with tools, which can submit input to stdin and read pretty printed result from stdout without worrying about errors intermingled with the actual result. 

But now we write errors to `stderr`, so the problem disappears and we can safely remove this `if`.

Errors should never pass silently, unless explicitly silenced.
2016-04-14 01:39:39 +03:00
Nick Cameron
14775eb046 Merge pull request #926 from rust-lang-nursery/closures
Be careful about where we change braces in closures
2016-04-14 09:32:30 +12: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
18246692c2 Merge pull request #914 from kamalmarhubi/invalid-operation-result
rustfmt: Make error handling more idiomatic
2016-04-14 08:40:55 +12:00
Srinivas Reddy Thatiparthy
58b022c56a Change stdout to stderr (#925) 2016-04-13 21:22:45 +02: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
c6084cb29c Fix the build 2016-04-12 11:04:33 +12:00
Nick Cameron
add81cb0a5 Merge pull request #918 from rust-lang-nursery/ty-variadic
Handle variadic function types
2016-04-12 10:48:08 +12:00
Nick Cameron
eadc878de0 Handle variadic function types
Closes #842
2016-04-12 10:47:35 +12:00