Commit graph

1400 commits

Author SHA1 Message Date
Nick Cameron
775de8a62b Optionally put short struct variants on one line (#997)
Closes #418
2016-05-18 22:38:49 +02:00
Nick Cameron
9589cac62d Format inline attributes on out-of-line modules (#996)
Fixes #838
2016-05-18 22:36:59 +02:00
Nick Cameron
78f8b6c2e3 Merge branch 'master' of github.com:rust-lang-nursery/rustfmt 2016-05-18 10:02:04 +12:00
Nick Cameron
ff3ff5aa87 Handle parser errors better 2016-05-18 09:58:51 +12:00
Nick Cameron
d0720a00a1 Fall back to basic stdout if we can't unwrap a fancy terminal (#995)
fixes #978
2016-05-17 23:25:57 +02:00
Nick Cameron
c8ba6ee5a2 Merge pull request #992 from srinivasreddy/master
change  normalise spelling to American version -
2016-05-16 10:15:29 +12:00
Nick Cameron
fcf33fbc2a Note in te README about compiler version
Closes #990
2016-05-16 10:09:53 +12:00
Srinivas Reddy Thatiparthy
952a6beb51 change normalise spelling to American version - normalize as American english is more common across programming community 2016-05-15 22:24:46 +05:30
Nick Cameron
9b05461666 Write each file as it is formatted (#991)
The old behaviour stored everything in memory until we were finished. Now we write as soon as we can.

This gives better behaviour when formatting large programs, since there is some progress indication. It also opens the door to optimising memory use by not storing everything in memory unless it is required (which it still might be). That is left as future work though.
2016-05-15 11:41:05 +02:00
Nick Cameron
67edc325c6 0.5 release 2016-05-13 12:34:55 -07:00
Nick Cameron
c1949f52e1 Merge pull request #893 from marcusklaas/try-shorthand
Try shorthand
2016-05-12 16:07:42 -07:00
Marcus Klaas
eae2921e14 Bootstrap it. Hard. 2016-05-12 21:50:43 +02:00
Marcus Klaas
cd158cecc8 Add try macro to try shorthand conversion tests 2016-05-12 21:15:06 +02:00
Marcus Klaas
ee7b5805fc Format try shorthand 2016-05-09 20:07:59 +02:00
Nick Cameron
fc2549b576 Merge pull request #981 from DanielJCampbell/generated
Altered FmtVisitor to function correctly on generated code
2016-05-06 14:02:56 +12:00
Daniel Campbell
238fc500ae Altered FmtVisitor to function correctly on generated code 2016-05-06 13:51:48 +12:00
Nick Cameron
b59b0497d3 Merge pull request #980 from DanielJCampbell/visibility
Changed modules & visitor mods to public, set filemap::write_file public
2016-05-06 13:09:46 +12:00
Daniel Campbell
4a2db3ec6c Changed modules & visitor mods to public, set filemap::write_file public 2016-05-06 12:44:18 +12:00
Nick Cameron
635581432f Merge pull request #979 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.32.0
2016-05-06 08:59:02 +12:00
Kamal Marhubi
8309d1a74c deps: Update syntex_syntax to 0.32.0 2016-05-05 16:39:34 -04:00
Nick Cameron
47631e2a5c Merge pull request #974 from sanxiyn/unused-trait-import
Remove unused trait imports
2016-05-04 08:32:26 +12:00
Seo Sanghyeon
f85c603c63 Remove unused trait imports 2016-05-03 21:52:55 +09:00
Nick Cameron
15d35a04b4 Merge pull request #973 from habnabit/fix-associated-items
Don't misplace the :: on associated items.
2016-05-03 17:22:50 +12:00
Aaron Gallagher
96d59366fc Don't misplace the :: on associated items.
The rewritten location of the :: on global paths for qpaths was wrong.
2016-05-02 17:11:22 -07:00
Nick Cameron
90c0f708f5 Merge pull request #971 from kamalmarhubi/update-syntex-syntax
deps: Update syntex_syntax to 0.31.0
2016-05-03 09:19:50 +12:00
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