Commit Graph

3951 Commits

Author SHA1 Message Date
Aaron Loucks
6ff2a5e0f3 Auto-detect newline style by default 2018-07-29 10:12:31 -04:00
Andrew Audibert
f121b1a3a9 Support raw identifiers in struct expressions 2018-07-28 19:40:52 -07:00
Daniel Carosone
1c6090c440 call out edition config in Quick start (#2837) 2018-07-28 18:04:55 +10:00
Nick Cameron
69ad879d52
Merge pull request #2864 from topecongiro/issue-2863
Modify the rule for reordering impl items
2018-07-27 16:24:46 +12:00
Nick Cameron
814f6339b4
Merge pull request #2862 from topecongiro/issue-2852
Preserve parens in trait bounds
2018-07-27 16:24:11 +12:00
Nick Cameron
7e3dc8fae7
Merge pull request #2865 from rust-lang-nursery/update-libsyntax-to-209
Update rustc-ap-syntax to 209.0.0.
2018-07-27 15:22:51 +12:00
kennytm
1e55de10f2
Update rustc-ap-syntax to 209.0.0.
This should fix the breakage caused by rust-lang/rust#51587.
2018-07-27 05:49:44 +08:00
Seiichi Uchida
7b37776ade Modify the rule for reordering impl items
1. If two items have the same kind, then reorder them based on its ident.
2. Handle existential type.
2018-07-26 21:37:23 +09:00
Seiichi Uchida
87c4bd5a94 Add a test for #2863 2018-07-26 21:35:48 +09:00
Seiichi Uchida
e6255ca3de Preserve parens in trait bounds 2018-07-25 18:27:25 +09:00
Seiichi Uchida
b7c443e948 Add and update tests for trait with paren 2018-07-25 18:27:02 +09:00
Nick Cameron
8ff2836eaf
Merge pull request #2861 from topecongiro/issue-2859
Put lifetimes after trait when they gets orphaned
2018-07-25 21:22:25 +12:00
Nick Cameron
e3fea15ca9
Merge pull request #2834 from topecongiro/issue-2830
Keep the context that we are inside macro in nested macro
2018-07-25 21:21:30 +12:00
Seiichi Uchida
1b69ed9ae4 Rename test files 2018-07-25 18:16:10 +09:00
Seiichi Uchida
339fa20973 Veto converting delimiters inside nested macro 2018-07-25 08:58:37 +09:00
Seiichi Uchida
6cecdd681f Put lifetimes after trait when they gets orphaned 2018-07-25 08:44:32 +09:00
Seiichi Uchida
6b8c6f5e0f Add a test for #2859 2018-07-25 08:33:41 +09:00
Seiichi Uchida
975b3753ba Keep the inside macro context in nested macro call 2018-07-25 07:15:33 +09:00
Seiichi Uchida
d512240206 Add tests for #2830 and #2857 2018-07-25 07:13:51 +09:00
Nick Cameron
2f03180040
Merge pull request #2860 from topecongiro/rustc-ap-syntax
Format existetenial type
2018-07-25 07:22:08 +12:00
Seiichi Uchida
a2b40bd70f Add a test for associated existential type 2018-07-25 00:42:19 +09:00
Seiichi Uchida
6d7a764b3d Remove span from rewrite_generics's parameter
We can just use the span from ast::Generics.
2018-07-25 00:34:46 +09:00
Seiichi Uchida
fc307ff582 Format exitential type 2018-07-25 00:30:01 +09:00
Seiichi Uchida
6eb0bf2bb9 Add a simple test for exitential type 2018-07-25 00:29:45 +09:00
Seiichi Uchida
0131110c97 Cargo update
Update `rustc-ap-*` to "206.0.0".
2018-07-25 00:22:27 +09:00
Nick Cameron
43f178bd58 Remove Summary 2018-07-24 21:45:15 +12:00
Nick Cameron
a24df1397e
Merge pull request #2838 from nrc/chains
Refactor chain formatting and fix some bugs
2018-07-24 15:50:49 +12:00
Nick Cameron
df4fb8a05b Reformatting after rebase 2018-07-24 15:49:35 +12:00
Nick Cameron
dcf9f61635 Add tests
Closes #2773
Closes #2786
2018-07-24 15:46:39 +12:00
Nick Cameron
4fa2969c39 fixup tests 2018-07-24 15:46:39 +12:00
Nick Cameron
f9510a55eb chains: fix visual indent chain layout 2018-07-24 15:46:39 +12:00
Nick Cameron
8618a55834 chains: treat some string lits as blocks 2018-07-24 15:46:39 +12:00
Nick Cameron
481e85cc58 formatting 2018-07-24 15:46:39 +12:00
Nick Cameron
f0fe9c3c4a chains: prefer to use the next line for an expression, if using the same line would introduce an open block or similar
This problem came to light due to the chains changes, but effects other code too. It only happens rarely, e.g.,

before this fix:
```
    match foo {
        MacroArgKind::Delimited(ref delim_tok, ref args) => rewrite_delimited_inner(
            delim_tok,
            args,
        ).map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs)),
    };

```

after:
```
    match foo {
        MacroArgKind::Delimited(ref delim_tok, ref args) => {
            rewrite_delimited_inner(delim_tok, args)
                .map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs))
        }
    }

```
2018-07-24 15:43:29 +12:00
Nick Cameron
5bc27593f4 chains: minor fixups
* remove unnecessary clone
* comment formatting
* fix bug with `?` collection
* respect the heuristic if the root is more than just the parent
2018-07-24 15:43:29 +12:00
Nick Cameron
467b095d48 chains: share code between block and visual formatters 2018-07-24 15:43:29 +12:00
Nick Cameron
f55cadb65a chains: refactor formatting of chain items 2018-07-24 15:43:29 +12:00
Nick Cameron
a56ff9d02f chains: factor into objects 2018-07-24 15:43:29 +12:00
Nick Cameron
86314bf09f chains: more refactoring of visual formatting 2018-07-24 15:43:29 +12:00
Nick Cameron
92701552bc chains: refactor block formatting 2018-07-24 15:43:29 +12:00
Nick Cameron
914e750c9e chains: further simplification 2018-07-24 15:43:29 +12:00
Nick Cameron
38e8b086e8 chains: refactoring
pre-process the expression tree to get a list of chain items.
2018-07-24 15:43:29 +12:00
Nick Cameron
9c82224746 chains: simplify visual formatting a bit 2018-07-24 15:43:29 +12:00
Nick Cameron
d244234607 factor out treatment of 1-length chains
And create `Chain` and `ChainItem` structs
2018-07-24 15:43:29 +12:00
Nick Cameron
a8d5f25572 chains: split handling of chains in block and visual cases
Just refactoring, lots of code dup here, but it should get better...
2018-07-24 15:43:29 +12:00
Nick Cameron
728b0182c5 Changes to chains with block indent
* More often combine a chain item to the previous line (if it is a block)
* Don't indent if the parent is a block

This is not perfect and doesn't pass tests, but I need to refactor to make more
progress
2018-07-24 15:43:29 +12:00
Nick Cameron
d3288841ea Refactoring: factor format_lines and format_project into smaller chunks 2018-07-24 15:17:47 +12:00
Nick Cameron
9fbce1f627 Reorganise formatting.rs 2018-07-24 14:10:09 +12:00
Nick Cameron
2af1ed109c Refactoring: factor out format_file and FormatHandler
This effectively separates out formatting from other handling.
2018-07-24 14:05:04 +12:00
Nick Cameron
b9c6754d8c Refactoring: move format_project and Timer out of Session 2018-07-24 10:08:41 +12:00