Seiichi Uchida
78e09bd05c
Cargo fmt
2018-03-31 14:47:50 +09:00
Seiichi Uchida
f6c0a0f4ed
Cargo fmt
2018-03-31 14:23:40 +09:00
Seiichi Uchida
01311c63ec
Format normalized use item
...
This commit implements `Rewrite` trait on `UseTree`, which is a normalized
form of `ast::UseTree` for rustfmt.
2018-03-31 14:23:36 +09:00
Seiichi Uchida
2b682b8ed5
Do not include separator to post comment
...
This prevents the trailing `;` on use item to be treated as comment.
2018-03-31 13:19:55 +09:00
Seiichi Uchida
a8022f3862
Do not insert newline when item is empty
...
This change is necessary when we remove unused imports (`use std::{};`).
2018-03-31 13:18:53 +09:00
Seiichi Uchida
13964b739e
Update tests
...
1. snake_case < CamelCase < UPPER_SNAKE_CASE
2. Use vertical layout for list with nested imports.
2018-03-31 13:16:36 +09:00
Seiichi Uchida
73e7235317
Cargo update ( #2575 )
...
Update `rustc-ap-syntax` to 82.0.0.
2018-03-30 17:52:09 +09:00
Seiichi Uchida
3de184fb0e
Merge pull request #2572 from codeworm96/remove_unreachable
...
Remove unreachable! from macros.rs
2018-03-29 09:16:38 +09:00
codeworm96
38107192f1
Add test for #2558
...
When run against invalid macro definitions, rustfmt should leave
them unchanged rather than panic.
2018-03-28 23:50:21 +08:00
codeworm96
e68682f6db
Remove unreachable! from macros.rs
...
replaced unreachable! with error handling using Option.
Closes #2558
2018-03-28 23:38:34 +08:00
Nick Cameron
72b715bad4
Merge pull request #2571 from topecongiro/issue-2569
...
Avoid panicking on macro call with a single comma
2018-03-28 17:02:49 +02:00
Nick Cameron
1644b174a7
Merge pull request #2557 from topecongiro/vertical-layout-complex-attrs
...
Use vertical layout for complex attributes
2018-03-28 17:01:16 +02:00
Nick Cameron
8dd08ddd92
Merge pull request #2562 from topecongiro/issue-2196
...
Combine simple heuristics for function calls and array
2018-03-28 16:49:25 +02:00
Seiichi Uchida
a49e00b4d7
Avoid panicking on macro call with a single comma
...
`parse_item` from libsyntax may return `None`, so we need to discard
the result in that case.
2018-03-28 18:14:51 +09:00
Seiichi Uchida
e5b403c944
Update tests
2018-03-28 17:42:24 +09:00
Seiichi Uchida
efd295a4e1
Follow indent style config when formatting attrs
2018-03-28 17:42:17 +09:00
Seiichi Uchida
0f55350c7d
Merge pull request #2563 from rleungx/allow-underscore
...
allow underscore in macro_rules!
2018-03-28 12:41:51 +09:00
rleungx
bf3bf8c235
allow underscore
2018-03-28 00:31:44 +08:00
Seiichi Uchida
752e2bd0ac
Merge pull request #2568 from mtn/features_typo
...
/s/featuers/features
2018-03-27 14:33:01 +09:00
Michael Noronha
faa9339e5d
/s/featuers/features
2018-03-26 22:40:39 -05:00
Nick Cameron
a4462d18bf
Merge pull request #2567 from cramertj/master
...
Allow stabilization of match_default_bindings
2018-03-26 23:07:34 +02:00
Taylor Cramer
72d8c9143b
Allow stabilization of match_default_bindings
2018-03-26 22:29:01 +02:00
Nick Cameron
53ecabad04
Merge pull request #2556 from topecongiro/issue-2554
...
Do not add the beginning vert to the match arm
2018-03-26 18:01:24 +13:00
Seiichi Uchida
48424ea765
Update tests and cargo fmt
2018-03-26 07:38:39 +09:00
Seiichi Uchida
98c6f7b731
Format array using overflow module
...
This commit applies heuristics used for function calls to array
and vice versa.
2018-03-26 07:36:44 +09:00
Seiichi Uchida
affa4ce1ec
Factor out default_tactic and fix indentation
...
rustfmt fails to handle binary expressions with comments in-between.
2018-03-26 07:34:17 +09:00
Seiichi Uchida
cf6c67e1a6
Replace MacroStyle with ast::DelimToken
2018-03-26 07:32:48 +09:00
Seiichi Uchida
903de92dae
Avoid cloning RewriteContext
2018-03-25 20:20:50 +09:00
topecongiro
c77708ff9a
Use vertical layout for complex attributes
2018-03-25 15:17:41 +09:00
Seiichi Uchida
1e1d9d4afe
Do not add the beginning vert to the match arm
...
Pass the span after the match's condition expression.
Closes #2554 .
2018-03-23 19:59:38 +09:00
Nick Cameron
2fbdedbf2f
Merge pull request #2549 from topecongiro/macro-def-spaces-around-colon
...
Add config option to control spaces around colon in macro def
2018-03-23 10:51:47 +13:00
Nick Cameron
50924839e8
Merge pull request #2553 from topecongiro/rustc-ap-syntax
...
Update rustc-ap-syntax to 73.0.0
2018-03-23 10:50:41 +13:00
topecongiro
ccec777f92
Cargo fmt and update tests
2018-03-22 16:09:21 +09:00
topecongiro
6115dcdbdc
Remove a space after a colon of metavariable def in macro def
2018-03-22 16:08:57 +09:00
topecongiro
d7c7991ed1
Update a test
2018-03-22 16:01:41 +09:00
topecongiro
b58a113370
Use UseSegment::Slf
or UseSegment::Super
when appropriate
...
Currently we `UseSegment::Ident` for all of the segments except the last.
E.g. `use super::foo::bar::self;` will be
`[Ident("super"), Ident("foo"), Ident("bar"), Self(None)]`.
in the current implementation. I think that this should be
`[Super(None), Ident("foo"), Ident("bar"), Self(None)]`.
instead.
I noticed this because some tests failed after updating
`rustc-ap-syntax` to 73.0.0.
2018-03-22 15:56:51 +09:00
topecongiro
846f4f21db
Fix libsyntax updates
...
`ast::UseTreeKind::Simple` now takes `Option<ast::Ident>`
instead of `ast::Ident`.
2018-03-22 15:55:14 +09:00
topecongiro
51d5696977
Fix libsyntax update
...
Underscore is now one of keywords.
2018-03-22 15:53:43 +09:00
topecongiro
32ab7f4967
Cargo update
...
Update rustc-ap-syntax to 73.0.0.
2018-03-22 15:53:08 +09:00
Nick Cameron
374dba833e
Merge pull request #2552 from alanhdu/master
...
Close #2551
2018-03-22 18:04:31 +13:00
Alan Du
d402cd20a8
Close #2551
2018-03-22 00:57:22 -04:00
Alan Du
d8723aaa8c
Fix build
2018-03-22 00:01:09 -04:00
Nick Cameron
ff9ab51617
Merge pull request #2550 from sinkuu/chars_count_index
...
Don't index a string with chars().count()/position()
2018-03-22 16:26:48 +13:00
Nick Cameron
0bc0241d2a
Merge pull request #2548 from topecongiro/match-mod
...
Do not collapse block around expr with condition on match arm
2018-03-22 15:40:36 +13:00
Nick Cameron
c593229171
Merge pull request #2535 from nrc/import-ord
...
Import ordering
2018-03-22 15:08:01 +13:00
Shotaro Yamada
83c8d23cc2
Omit unnecessary UTF-8 decoding
2018-03-22 08:34:53 +09:00
Shotaro Yamada
e5572bbb66
Use take_while
2018-03-22 08:34:36 +09:00
Shotaro Yamada
4757321277
Don't index a string with chars().count()
2018-03-22 08:33:18 +09:00
Seiichi Uchida
5b9b7d5b9f
Do not collapse block around expr with condition on match arm
...
Closes #2376 .
2018-03-21 22:21:08 +09:00
Seiichi Uchida
88589f2ad8
Add matches module
...
`matches` module contains `rewrite_match` and related stuffs.
2018-03-21 22:21:08 +09:00