Nick Cameron
f9510a55eb
chains: fix visual indent chain layout
2018-07-24 15:46:39 +12:00
Nick Cameron
8618a55834
chains: treat some string lits as blocks
2018-07-24 15:46:39 +12:00
Nick Cameron
481e85cc58
formatting
2018-07-24 15:46:39 +12:00
Nick Cameron
f0fe9c3c4a
chains: prefer to use the next line for an expression, if using the same line would introduce an open block or similar
...
This problem came to light due to the chains changes, but effects other code too. It only happens rarely, e.g.,
before this fix:
```
match foo {
MacroArgKind::Delimited(ref delim_tok, ref args) => rewrite_delimited_inner(
delim_tok,
args,
).map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs)),
};
```
after:
```
match foo {
MacroArgKind::Delimited(ref delim_tok, ref args) => {
rewrite_delimited_inner(delim_tok, args)
.map(|(lhs, inner, rhs)| format!("{}{}{}", lhs, inner, rhs))
}
}
```
2018-07-24 15:43:29 +12:00
Nick Cameron
5bc27593f4
chains: minor fixups
...
* remove unnecessary clone
* comment formatting
* fix bug with `?` collection
* respect the heuristic if the root is more than just the parent
2018-07-24 15:43:29 +12:00
Nick Cameron
467b095d48
chains: share code between block and visual formatters
2018-07-24 15:43:29 +12:00
Nick Cameron
f55cadb65a
chains: refactor formatting of chain items
2018-07-24 15:43:29 +12:00
Nick Cameron
a56ff9d02f
chains: factor into objects
2018-07-24 15:43:29 +12:00
Nick Cameron
86314bf09f
chains: more refactoring of visual formatting
2018-07-24 15:43:29 +12:00
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