Commit Graph

3466 Commits

Author SHA1 Message Date
Shotaro Yamada
e2d801f11e Do not turn spaces in the beginning of the file into a newline (#2583) 2018-04-01 23:09:53 +09:00
Shotaro Yamada
56e10aa6e9 Fix typo 2018-04-01 22:29:26 +09:00
Shotaro Yamada
3467b4dafe Use ListItem::has_comment 2018-04-01 22:29:26 +09:00
Shotaro Yamada
ba792a7fa2 Remove redudant parens 2018-04-01 22:29:26 +09:00
Shotaro Yamada
71448ff3c2 Return String instead of always returing Cow::Owned 2018-04-01 22:29:26 +09:00
Shotaro Yamada
39e85281f3 Remove stray comment
Its pointee was removed in 04a6d16c7b
2018-04-01 22:29:26 +09:00
Shotaro Yamada
a2325375ed Do not collect into a Vec by hand 2018-04-01 22:29:26 +09:00
Shotaro Yamada
89200f40ff Remove unnecessary [..]s 2018-04-01 22:29:26 +09:00
Shotaro Yamada
6b3811a358 Use Iterator methods 2018-04-01 22:29:26 +09:00
Shotaro Yamada
ed46a777c8 Use str::repeat 2018-04-01 22:29:26 +09:00
Shotaro Yamada
1d3bc68496 Rerun build.rs only when .git/HEAD or CFG_RELEASE_CHANNEL is changed 2018-04-01 16:48:59 +09:00
Remi Rampin
37ee9c20aa Improve where_single_line help 2018-03-31 18:51:41 -04:00
Ivan Sorokin
e6423cf4b1 Add test #2574 (#2577) 2018-04-01 00:54:44 +09:00
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