Nick Cameron
92701552bc
chains: refactor block formatting
2018-07-24 15:43:29 +12:00
Nick Cameron
914e750c9e
chains: further simplification
2018-07-24 15:43:29 +12:00
Nick Cameron
38e8b086e8
chains: refactoring
...
pre-process the expression tree to get a list of chain items.
2018-07-24 15:43:29 +12:00
Nick Cameron
9c82224746
chains: simplify visual formatting a bit
2018-07-24 15:43:29 +12:00
Nick Cameron
d244234607
factor out treatment of 1-length chains
...
And create `Chain` and `ChainItem` structs
2018-07-24 15:43:29 +12:00
Nick Cameron
a8d5f25572
chains: split handling of chains in block and visual cases
...
Just refactoring, lots of code dup here, but it should get better...
2018-07-24 15:43:29 +12:00
Nick Cameron
728b0182c5
Changes to chains with block indent
...
* More often combine a chain item to the previous line (if it is a block)
* Don't indent if the parent is a block
This is not perfect and doesn't pass tests, but I need to refactor to make more
progress
2018-07-24 15:43:29 +12:00
topecongiro
e5e1e0cea8
Fix compile errors from breaking changes in libsyntax
...
cc https://github.com/rust-lang/rust/pull/48149 .
2018-06-25 15:24:00 +09:00
Nick Cameron
d726492e65
Remove spaces_within_parens_and_brackets
...
cc #1974
2018-05-18 16:35:09 +12:00
topecongiro
bd25c7d0f7
Cargo fmt
2018-05-08 06:25:48 +09:00
topecongiro
0ec311ee07
Apply small parent rule only when there is small offset
2018-05-08 06:25:06 +09:00
topecongiro
1f738ea208
Cargo fmt
2018-05-06 15:22:29 +09:00
csmoe
f7415bcea2
update self format
2018-04-29 20:53:31 +08:00
Nick Cameron
1415a4dc23
Fix tests
2018-04-14 10:20:08 +12:00
Nick Cameron
01c1f99e39
Fallout from removing TupField
2018-04-14 10:15:39 +12:00
csmoe
84d3659767
update rustc syntax 91.0.0
2018-04-08 22:22:11 +08:00
Shotaro Yamada
39e85281f3
Remove stray comment
...
Its pointee was removed in 04a6d16c7b68587f8e9fa8a1e6715f80408b023b
2018-04-01 22:29:26 +09:00
Shotaro Yamada
89200f40ff
Remove unnecessary [..]
s
2018-04-01 22:29:26 +09:00
Shotaro Yamada
ed46a777c8
Use str::repeat
2018-04-01 22:29:26 +09:00
Nick Cameron
50c95a074a
cargo fmt
2018-03-20 09:27:31 +13:00
Nick Cameron
124f03b1fc
Merge pull request #2516 from topecongiro/issue-2510
...
Make rewrite_call_inner more generic
2018-03-12 11:18:14 +13:00
David Lukes
a41947cd7d
Enable doctests
...
Doctests were disabled globally because up until #2456 , they were just
formatting examples which were not supposed to compile. Now that there
is one runnable doctest, I disabled the other ones individually (by
adding the ignore directive).
I also added some empty lines around the code blocks to avoid the
following warning and instead ignore the code blocks cleanly:
WARNING: ... Code block is not currently run as a test, but will in
future versions of rustdoc. Please ensure this code block is a runnable
test, or use the `ignore` directive.
See rust-lang/rust#28712 for further details.
2018-03-10 09:57:01 +01:00
Seiichi Uchida
8943c376bc
Use RefCell for RewriteContext fields
2018-03-09 14:07:05 +09: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
1ef6bccea3
Cargo fmt
...
Run 'cargo fmt' with the following setting:
```
reorder_imports = true
reorder_imports_in_group = true
```
2017-12-24 00:28:58 +09:00
Nick Cameron
0c9b2b402e
Merge pull request #2267 from topecongiro/issue-2264
...
Remove block() and block_only() wherever possible
2017-12-11 09:02:16 +13:00
Seiichi Uchida
a7060f9fdf
Remove excessive block() and block_only()
...
Since we now use the same indent style for every expressions, these safe guards
can be removed.
2017-12-10 23:39:09 +09:00
Seiichi Uchida
e3d2f2c2b1
Cargo fmt
2017-12-10 21:54:26 +09:00
Seiichi Uchida
0c1eb20575
Fix indent of chain with small parent
2017-12-05 10:03:23 +09:00
Seiichi Uchida
026c716168
Cargo fmt
2017-12-03 11:38:16 +09:00
Oliver Schneider
9667cc2484
Address clippy lints
2017-11-30 09:24:10 +01:00
topecongiro
8b53d7806c
Cargo fmt
2017-11-29 17:37:51 +09:00
topecongiro
be19bab9de
Take into account the rhs overhead when rewriting the last element of chain
2017-11-29 17:29:38 +09:00
Nick Cameron
4e04e825b5
Use the right kind of doc comment in chains.rs
...
cc #2185
2017-11-28 15:03:02 +13: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
d00c60df5c
Remove chain_split_single_child
option
2017-11-24 14:12:54 +13:00
topecongiro
34c2499029
Cargo fmt
2017-11-16 17:43:06 +09:00
topecongiro
bc543cce0b
Combine spaces_within_parens and spaces_within_brackets
2017-11-14 23:42:31 +09:00
topecongiro
04f09c9d85
Replace '*_indent' with 'indent_style' in src
2017-11-13 17:33:32 +09:00
topecongiro
6a31415867
Use correct shape when there is a single child
2017-11-08 08:25:23 +09:00
topecongiro
d287b06eba
Rename 'chain_one_line_max' to 'chain_width'
2017-11-04 22:24:43 +09:00
topecongiro
b17de6228f
Cargo fmt
2017-11-02 21:45:00 +09:00
Martin Lindhe
f930a16b8d
fix some typos
2017-11-01 07:33:55 +01:00
topecongiro
142fc45dbb
Take the width of trailing '?'s into account
2017-10-18 22:23:25 +09:00
topecongiro
ad47a71012
Do not distinguish between a single-child chain from others
...
`last_shape` is used when rewriting the last child on its own line.
2017-10-18 22:23:25 +09:00
topecongiro
51d230ead3
Use trimmed_last_line_width()
2017-10-18 22:23:25 +09:00
Seiichi Uchida
c7250d18b1
Fix a typo
2017-10-09 22:44:00 +09:00
Seiichi Uchida
923a7bc1d9
Update doc comments in chains.rs
2017-10-07 22:45:33 +09:00
Seiichi Uchida
7359d3ad34
Simplify join_rewrites()
2017-10-07 22:45:33 +09:00