Commit Graph

146 Commits

Author SHA1 Message Date
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
Seiichi Uchida
e588f2fd7b Make definitive_tactic more generic via enum Separator 2017-07-31 16:23:42 +09:00
Seiichi Uchida
570a3505b9 Make definitive_tactic more generic with separator length 2017-07-29 22:13:23 +09:00
Seiichi Uchida
261865ecc9 Remove newlines between list elements for expressions 2017-07-26 22:43:36 +09:00
Seiichi Uchida
a8b0a6e4c5 Format source codes and update tests 2017-07-20 00:42:00 +09:00
topecongiro
dcb953b901 Add trailing comma when using Mixed indent style with newline 2017-07-13 20:32:46 +09:00
topecongiro
6fd291981e Sort imports in alphabetical and consistent order 2017-07-13 18:42:14 +09:00
topecongiro
e3310a6a18 Format source codes 2017-07-11 21:53:10 +09:00
topecongiro
f7ec959c97 Use closure instead of declaring function
Take comment overhead into account
2017-07-07 09:04:06 +09:00
topecongiro
1de786a79a Implement vertical alignment for comments after list structure 2017-07-07 09:04:06 +09:00
topecongiro
2dd8d6d097 Add Clone trait bound to write_list 2017-07-07 09:04:06 +09:00