Ivan Sorokin
3fe2233fd3
Fix error_on_unformatted and skip_children override
...
Currently, error_on_unformatted and skip_children options
specified in the config file are discarded.
This happens because CLI options have a higher priority,
but we coerce an absence of a `bool` option to `false`.
In this scenario, an absence of a `bool` option is indistinguishable
from explicetely set as `false`. We should coerce it to `None` instead,
so it does not override the one in the config file.
2018-04-05 23:13:17 +02:00
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
4237f40c50
Merge pull request #2581 from sinkuu/build_script
...
Rerun build.rs only when .git/HEAD or CFG_RELEASE_CHANNEL is changed
2018-04-05 17:35:52 +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
8f615af44e
Add a test for #2569
2018-04-05 13:23:48 +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
a43ac40a78
Add tests for #2588
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
Ryan Leung
2c7e737a06
add tests for macro!(/* comment */) ( #2592 )
...
* add tests
2018-04-04 11:02:01 +09:00
Russell Cohen
2e7d1a1184
Include instructions to install on nightly ( #2590 )
2018-04-03 11:10:50 +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 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