Nick Cameron
55dd8f1df0
Merge pull request #2603 from topecongiro/merge-nested-imports
...
Merge imports
2018-04-12 16:40:06 +12:00
Seiichi Uchida
e58e97783e
Preserve trailing comma on macro call when using mixed layout
2018-04-12 09:54:00 +09:00
Seiichi Uchida
1954513ace
Merge imports with the same prefix into a single nested import
2018-04-10 12:36:57 +09:00
Nick Cameron
4b2160e1b2
Merge pull request #2599 from topecongiro/issue-2596
...
Use multiple lines for imports list which exceeds max width
2018-04-06 11:12: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
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
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
Nick Cameron
0cf80dcce7
Better handle comments and newlines around erased imports
2018-03-20 09:27:31 +13:00
Nick Cameron
39301ae5f2
Go back to a non-workspace structure
...
Kinda reverts https://github.com/rust-lang-nursery/rustfmt/pull/2419
2018-03-02 14:58:23 +13:00
topecongiro
4af2aa3a9e
Create rustfmt_core crate
2018-02-07 22:48:05 +09:00
Seiichi Uchida
154bf8e1af
Cargo fmt
2018-01-22 13:05:18 +09:00
David Wood
39e2f43f91
Split assert_eq! if any arguments are not simple
2017-12-27 21:19:42 +00:00
David Wood
212a8a3c29
Slightly simplify write_list
for DefinitiveListTactic::SpecialMacro
2017-12-24 12:29:54 +00:00
David Wood
e343521276
Add assert_eq! to special-cased macros
...
Allows for this form of assert_eq! macros:
```rust
assert_eq!(
left.id, right.id,
"IDs are not equal: {:?} {:?}",
left, right
);
```
Also allows for assert! macros to have the format arguments split across
multiple lines even if the assert condition is not simple:
```rust
assert!(
result >= 42,
"The result must be at least 42: {:?}",
result, result.code, context
);
```
2017-12-23 01:06:17 +00:00
Nick Cameron
b07e4339f0
Merge pull request #2221 from topecongiro/rfc/blank-lines
...
Keep vertical spaces between items or statements within range
2017-12-06 15:52:19 +13:00
Seiichi Uchida
228578b9c7
Add count_newlines() utility function
2017-12-05 15:17:40 +09:00
topecongiro
0f5dcc665d
Handle special-case macros
2017-12-03 11:34:18 +09:00
Oliver Schneider
9667cc2484
Address clippy lints
2017-11-30 09:24:10 +01:00
Nick Cameron
dd1fbca99a
Replace various small width heuristics with a single option
...
Closes #1984
2017-11-24 20:17:06 +13:00
Nick Cameron
45d4f7a2dd
struct_lit_multiline_style -> struct_lit_single_line (and make it a bool)
2017-11-24 14:45:18 +13:00
topecongiro
d92cfff43b
Align post comments with items when the it starts with newline
2017-11-23 12:38:34 +09:00
topecongiro
53d7489221
Force vertical layout when we find any kind of single line comments
2017-11-23 12:37:12 +09:00
topecongiro
311a3c526c
Fix up write_list() to handle Mixed tactic
2017-11-16 17:43:36 +09:00
topecongiro
35466adbfe
Generalize ListItems to allow a separator other than comma
2017-11-16 17:43:36 +09:00
topecongiro
95c7325ac2
Do not get tricked by a nested comment
2017-11-15 15:46:00 +09:00
topecongiro
37b1779426
Look for a newline after match arm only when there is one
2017-11-15 12:22:50 +09:00
topecongiro
04f09c9d85
Replace '*_indent' with 'indent_style' in src
2017-11-13 17:33:32 +09:00
topecongiro
40c5666af6
Rename 'struct_lit_style' to 'struct_lit_indent'
2017-11-04 22:47:28 +09:00
Martin Lindhe
f930a16b8d
fix some typos
2017-11-01 07:33:55 +01:00
Nick Cameron
802df67c2f
Merge pull request #2035 from topecongiro/deprecate-try_opt!
...
Replace `try_opt!` macro with a `?` operator
2017-10-05 20:45:52 +08:00
topecongiro
fe69dde96b
Replace 'try_opt!' macro with a '?' operator
2017-10-05 20:50:19 +09:00
Shohei Wada
25d2671c55
Fix broken tests under CRLF env.
2017-10-05 00:23:17 +09:00
topecongiro
b12fecb631
Use horizontal layout for a function with a single argument
...
foo(long_arg)
instead of
foo(
long_arg,
)
2017-09-19 11:41:05 +09:00
Seiichi Uchida
df7d2be562
Move Indent and Shape to shape.rs from lib.rs
2017-09-19 10:04:35 +09:00
Nick Cameron
cccb7f681e
Merge pull request #1966 from topecongiro/string-to-cow
...
Refactoring: use Cow and etc.
2017-09-18 12:45:25 +12:00
topecongiro
f0580ae91a
Use Cow to avoid unnecessary allocation
2017-09-15 18:21:06 +09:00
topecongiro
0b5d524486
Remove unnecessary references
2017-09-15 17:09:30 +09:00
topecongiro
f51261e93e
Cargo fmt
2017-09-15 12:10:58 +09:00
Nick Cameron
435ab867c3
Merge pull request #1945 from topecongiro/issue-1095
...
Exclude prefix colon from span when rewriting comment
2017-09-05 11:00:31 +12:00
Seiichi Uchida
c720a3a38e
Remove colon from faulty span
2017-09-05 01:04:31 +09:00
topecongiro
467b7b5a6c
Take attributes_on_same_line_as_field into account
2017-09-04 16:15:32 +09:00
Seiichi Uchida
4b79055a15
Apply refactoring from cargo clippy
2017-08-31 12:49:12 +09:00
topecongiro
fd10d25680
Allow pre-line single-lined comments to stay on the same line
2017-08-27 14:41:15 +09:00
topecongiro
5dafcc24e4
Add merge_derives config option
2017-08-24 22:29:56 +09:00
Seiichi Uchida
63ac49638b
Support match_pattern_separator_break_point config option
2017-08-18 23:19:47 +09:00
Seiichi Uchida
f9d279576f
Use write_list() for rewriting match arms
2017-08-18 23:15:56 +09:00
topecongiro
be38606c77
Add leave_last field to ListItems
2017-08-09 16:37:21 +09:00
topecongiro
021f922b9c
Keep the pre-comment on the same line with item if it fits max width
2017-08-08 18:24:06 +09:00