Commit graph

656 commits

Author SHA1 Message Date
topecongiro
bcebe9e7de Use different style when rewriting comment with different opener 2017-05-29 11:28:48 +09:00
topecongiro
72c04facd2 Add tests for issues which can be closed on the current master
This PR adds tests for #325, #1092,  #1214, #1278, #1329 and #1427.
2017-05-28 13:24:05 +09:00
Nick Cameron
8ac3fc36cc Merge pull request #1597 from topecongiro/comments-after-attributes
Allow comments after attributes of struct fields
2017-05-27 13:47:42 +12:00
Nick Cameron
aad250e20e Merge pull request #1596 from topecongiro/issue-1595
Add a trailing comma if the last arg ends with comment
2017-05-27 13:38:14 +12:00
Nick Cameron
2dc4298b71 Merge pull request #1593 from topecongiro/issue-1439
Allow comments after where clause
2017-05-27 13:34:50 +12:00
Nick Cameron
4e5df80c03 Merge pull request #1588 from topecongiro/nesting-macro
Allow macro to be nested like function call
2017-05-27 13:28:47 +12:00
topecongiro
b6c503ac32 Allow comments after attributes of struct fields 2017-05-27 09:36:25 +09:00
topecongiro
67e8a690ff Add a trailing comma if the last arg ends with comment 2017-05-27 07:33:06 +09:00
topecongiro
dab14b4485 Allow comments after where clause 2017-05-27 02:07:58 +09:00
topecongiro
fcffe854b8 Allow default associated types 2017-05-26 17:17:12 +09:00
topecongiro
554605d47c Format source codes and add tests 2017-05-26 16:40:19 +09:00
topecongiro
0869bca85a Put closing paren on the next line when the last arg contains comment 2017-05-26 13:15:10 +09:00
Nick Cameron
3d135ebba4 Merge pull request #1586 from topecongiro/minor
Fix minor bugs
2017-05-26 08:43:52 +12:00
Seiichi Uchida
92270ba191 Add offset when rewriting index 2017-05-25 23:01:41 +09:00
Seiichi Uchida
189b6bd7bb Update tests 2017-05-25 22:55:33 +09:00
topecongiro
986abc24b4 Add a test for #1380 2017-05-25 16:30:45 +09:00
topecongiro
86856491bc Format source codes 2017-05-25 16:08:08 +09:00
topecongiro
2580d7a310 Add chain_split_single_child option 2017-05-25 16:07:56 +09:00
topecongiro
c69608a7e0 Allow the last elem in chain to overflow 2017-05-25 15:50:46 +09:00
topecongiro
635fdc662a Format source codes 2017-05-25 15:50:46 +09:00
topecongiro
c8ad521c9f Decide whether args fit in a single line inside rewrite_call_args 2017-05-25 06:10:00 +09:00
Nick Cameron
93c556c6ba Merge pull request #1578 from topecongiro/poor/macro
Use original code snippet for macro which contains invalid syntax
2017-05-24 11:43:10 +12:00
topecongiro
e3eec44690 Return original snippet when macro contains invalid syntax 2017-05-24 07:24:31 +09:00
topecongiro
04bb5d8929 Format source codes 2017-05-24 00:07:02 +09:00
topecongiro
ec33121aaf Format source codes 2017-05-23 22:13:29 +09:00
topecongiro
f83c22f24f Add trailing comma to a single arg in multiline 2017-05-23 13:26:59 +09:00
topecongiro
b4cd9584b3 Implement combining for tuple and block 2017-05-23 12:51:32 +09:00
topecongiro
2c15204f0c Update tests 2017-05-23 12:51:13 +09:00
topecongiro
dc8d3aa23a Update tests 2017-05-23 11:39:31 +09:00
topecongiro
13af774e55 Fix weird indentaion in chain 2017-05-23 11:37:12 +09:00
topecongiro
d16a0a399e Implement 'vec![expr; expr]' 2017-05-23 11:32:09 +09:00
Michael Killough
bce1f309b7 Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config 2017-05-19 16:10:27 +07:00
Ben Boeckel
8ca699ce26 config: fix suffices -> suffixes typo
Fixes #1477.
2017-05-18 08:03:47 -04:00
Seiichi Uchida
c0fae6a82a Merge pull request #1562 from flier/reorder_imports_in_group
reorder imports in group
2017-05-18 17:53:23 +09:00
Michael Killough
c3c2e823cb Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config 2017-05-18 13:05:19 +07:00
Flier Lu
1077a100a1 reorder imports in group 2017-05-18 13:26:34 +08:00
Michael Killough
222bac1397 Provide config.set().item(value) API.
This API isn't fantastic, but it's the best I can come up with without
something like `concat_idents!()`. There are relatively few places where
config is set, to hopefully the ugliness isn't disastrous.

Change previous occurences of `config.item = value` to this new API,
rather than using `config.override_value()`. Undo the changes to
`override_value()`, as it's no longer important to propogate the error
to the caller. Add a test for the new interface.
2017-05-18 11:42:32 +07:00
topecongiro
cfff3bd91e Use multiline when signature does not fit single line 2017-05-17 16:31:09 +09:00
Nick Cameron
6a70e9c22c Merge pull request #1559 from topecongiro/poor/chain
Allow the last element in chain to go multiline
2017-05-17 17:43:42 +12:00
topecongiro
d7b6f1199f Format source codes 2017-05-16 23:24:38 +09:00
Michael Killough
dcd3c0ed2e Add test for issue #1366.
As the comments in the issue state: it appears to work now, so this test
should just stop any regressions.

The second example in the issue description will format to the first,
which is then a fixed-point.
2017-05-16 16:17:46 +07:00
Michael Killough
c0bdbfa531 Switch to accessing config items via method.
Preparation for #865, which proposes adding a flag which outputs which
config options are used during formatting.

This PR should not make any difference to functionality. A lot of this
was search-and-replace.

Some areas worthy of review/discussion:

 - The method for each config item returns a clone of the underlying
   value. We can't simply return an immutable reference, as lots of
   places in the code expect to be able to pass the returned value as
   `bool` (not `&bool). It would be nice if the `bool` items could
   return a copy, but the more complex types a borrowed reference... but
   unfortunately, I couldn't get the macro to do this.
 - A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
   config items by modifying the fields of the `Config` struct directly.
   They now use the existing `override_value()` method, which has been
   modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
   benefits of this are that the complex `file_lines` and `write_mode`
   strings are now parsed in one place (`Config.override_value`) instead
   of multiple. The disadvantages are that it moves the compile-time
   checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00
Seiichi Uchida
79ba34c607 Use offset_left for rewrite_unary_prefix 2017-05-15 22:55:01 +09:00
Nick Cameron
d1682b3473 Merge pull request #1510 from fintelia/better-filelines
Better file_lines
2017-05-15 09:19:18 +12:00
Nick Cameron
0ebd5775d7 Merge pull request #1550 from topecongiro/issue-1547
Prevent rewriting closure block to expr inside macro
2017-05-15 08:46:14 +12:00
Jonathan Behrens
4d2f6a29a7
Add and improve tests of file_lines 2017-05-13 13:45:35 -04:00
Seiichi Uchida
7ec78711f2 Prevent rewriting closure block to expr inside macro 2017-05-13 18:32:25 +09:00
Seiichi Uchida
d0a094eefb Merge pull request #1546 from topecongiro/bug/range-full
Add a missing trailing comma before elipses
2017-05-13 17:40:47 +09:00
topecongiro
4aa64674c9 Add a missing trailing comma before elipses 2017-05-13 07:23:34 +09:00
Seiichi Uchida
56515dd4d6 Merge pull request #1543 from topecongiro/field-attr
Support struct_field_attributes
2017-05-12 20:08:36 +09:00