Nick Cameron
662811b3f0
Merge pull request #1584 from topecongiro/poor/chain-trailing-try
...
Enhance chain
2017-05-26 08:35:25 +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
Seiichi Uchida
10c7934700
Be precise with one_line_budget for fn_base
2017-05-25 22:55:11 +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
4d6e385f09
Refactoring: introduce one_line_budget
2017-05-25 15:50:46 +09:00
topecongiro
635fdc662a
Format source codes
2017-05-25 15:50:46 +09:00
topecongiro
6aed417738
Disallow single line chain when the line exceeds the given budget
2017-05-25 15:50:46 +09:00
topecongiro
857747c9ca
Consider trailing try operations when counting almost_total
2017-05-25 15:50:46 +09:00
Nick Cameron
a7b8dcc60d
Simplify --version info
2017-05-25 16:39:44 +12:00
Nick Cameron
393ba27311
Remove dependency on Itertools
2017-05-25 16:23:07 +12:00
Nick Cameron
80f3b3c9c4
Remove multimap dep
2017-05-25 15:59:06 +12:00
Nick Cameron
08f631de43
Merge pull request #1582 from topecongiro/poor/fn_call_style_block
...
Decide whether args fit in a single line inside rewrite_call_args
2017-05-25 10:50:17 +12: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
Nick Cameron
cb464a919a
Merge pull request #1576 from topecongiro/chain/float-first-child
...
Allow first child to stay on the same line with block parent when rewriting chain
2017-05-24 08:47:10 +12:00
topecongiro
04bb5d8929
Format source codes
2017-05-24 00:07:02 +09:00
topecongiro
92b54d6490
Add heuristic when rewriting chain with a single child
...
rustfmt splits chain into multiline when the length of chain exceeds
`chain_one_line_max`. However, currenly this rule only applies when the chain
has more than one child. This can lead to unexpected long chain if the parent
is long. This commit adds heuristic that if the length of parent is longer
than the half of `chain_one_line_max` we use multiline even if there is
only a single child.
2017-05-24 00:06:23 +09:00
topecongiro
ec33121aaf
Format source codes
2017-05-23 22:13:29 +09:00
topecongiro
cb4a6a2419
Use correct width when rewriting chain
2017-05-23 22:12:52 +09:00
topecongiro
a83d4876e7
Allow first child to stay on the same line with block parent
2017-05-23 22:12:37 +09:00
Nick Cameron
7c8432f05b
Merge pull request #1572 from topecongiro/nested-block
...
Nesting of block indented expressions
2017-05-23 18:35:21 +12: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
29c0ab77ba
Implement combining openings and closings
2017-05-23 12:45:09 +09:00
Seiichi Uchida
eb8d67196c
Merge pull request #1565 from topecongiro/issue-1563
...
Implement vec![expr; expr] and avoid unnecessary indent in chain
2017-05-23 12:44:47 +09:00
topecongiro
dc8d3aa23a
Update tests
2017-05-23 11:39:31 +09:00
topecongiro
77a2e9858b
Format source codes
2017-05-23 11:37:33 +09:00
topecongiro
f2ec5a7bac
Refactor source codes
2017-05-23 11:37:12 +09:00
topecongiro
520340481d
Allow macro rewrite to fail on rhs
2017-05-23 11:37:12 +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
Nick Cameron
068b8b3b5c
Merge pull request #1558 from mjkillough/config
...
Add a flag to emit which options are used
2017-05-22 12:13:22 +12: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
Nick Cameron
fdf950b009
Merge pull request #1569 from mathstuf/example-typos
...
Configurations: fix typos in example signatures
2017-05-19 11:57:44 +12:00
Nick Cameron
443cd1cb2f
Merge pull request #1568 from mathstuf/suffixes-typo
...
config: fix `suffices` -> `suffixes` typo
2017-05-19 11:57:15 +12:00
Ben Boeckel
59cefa988a
Configurations: fix typos in example signatures
2017-05-18 08:17:09 -04: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
Michael Killough
31c8fb4e76
Add --dump-default-config and --dump-minimal-config.
...
- `--dump-default-config` outputs the default configuration to the
specified file as TOML and then exits.
- `--dump-minimal-config` is checked after formatting files as normal.
If present, any configuration options that were checked during
formatting are written to the specified file as TOML.
- These options were added only to `rustfmt`, not to `cargo fmt`. They
can be specified when using `cargo fmt` by placing them after `--`.
- It would have been nice if the filename was optional, so you could
run just `rusfmt --dump-minimal-config build.rs` to have it output to
`rustfmt.toml`. However, this doesn't do what you might expect: it
outputs the config to `build.rs`!
2017-05-18 12:56:49 +07:00
Flier Lu
1077a100a1
reorder imports in group
2017-05-18 13:26:34 +08:00
Michael Killough
3f34ff8229
Return PartialConfig
from Config
methods.
...
Leave serialization to the caller, but provide a
`PartialConfig.to_toml()` method, to deal with the fact that
`file_lines` can't be serialized.
Add a simple test.
2017-05-18 12:10:25 +07: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
Michael Killough
9e26575ed8
Use unreachable!() instead of panic!().
2017-05-18 11:09:11 +07:00