2279 Commits

Author SHA1 Message Date
Nick Cameron
b7ba6f70b1
Merge pull request #2576 from topecongiro/merge-imports
Use normalized form to format use items
2018-04-05 17:39:22 +12:00
Nick Cameron
0156fe07ac
Merge pull request #2589 from topecongiro/issue-2588
Do not indent or unindent inside string literal
2018-04-05 17:36:15 +12:00
Nick Cameron
a318bc887f
Merge pull request #2580 from remram44/improve-where_single_line-help
Improve `where_single_line` help
2018-04-05 17:34:53 +12:00
Seiichi Uchida
97ec417e74 Add trailing comma when using mixed layout with block indent 2018-04-05 13:27:42 +09:00
Seiichi Uchida
636de8313d Put imports list on the next line if it exceeds max width 2018-04-05 13:24:18 +09:00
Seiichi Uchida
ec1907b2a4 Do not indent or unindent inside string literal
Closes #2588.
2018-04-05 12:52:43 +09:00
Seiichi Uchida
89070a2244 Implement LineClasses 2018-04-05 12:52:43 +09:00
Seiichi Uchida
fa80ddf876 Reorder impl items based on its kind
The ordering is defined as follows:

type < cosnt < macro < method

Items that are same kind will not be reordered: that is, the item
that an user has put first comes first.
2018-04-05 12:49:16 +09:00
Seiichi Uchida
94f5a05a6a Add reorder_impl_items config option 2018-04-05 12:49:16 +09:00
memoryleak47
d48cbedfe4 typo (#2598)
* typo

* more typos
2018-04-05 12:47:09 +09:00
Marthog
bc05621f9b Let --dump-default-config default to stdout #2579 (#2586) 2018-04-01 23:15:25 +09:00
Seiichi Uchida
dec307b2fa
Merge pull request #2584 from sinkuu/cleanup
Misc cleanups
2018-04-01 23:14:52 +09:00
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 04a6d16c7b68587f8e9fa8a1e6715f80408b023b
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
Remi Rampin
37ee9c20aa Improve where_single_line help 2018-03-31 18:51:41 -04: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
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
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
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
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
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