Hirokazu Hata
8183b949c4
cargo fmt
2019-02-09 16:20:38 +09:00
Hirokazu Hata
4bb90f5cc8
Fix rust_2018_idioms warnings
2019-02-09 16:14:30 +09:00
Evgenii
ece629b1cc
transition to Rust 2018
2019-02-04 13:30:43 +03:00
Nick Cameron
4bb84f6002
Remove NLL feature
...
And do some refactoring in comments.rs
Closes #3107
2018-10-18 15:39:11 +13:00
Nick Cameron
e29fd7bebe
Only put {
on a newline in a match arm where necessary
...
Fixes #3005
2018-10-15 14:06:52 +13:00
Nick Cameron
1b2e72726f
Merge pull request #3078 from YaLTeR/fix-closure-indentation
...
Fix inconsistent overflow behavior in Visual style
2018-10-08 14:38:49 +13:00
Ivan Molodetskikh
dee68434e6
Overflow Visual functions even with one argument
2018-10-06 16:32:38 +03:00
Seiichi Uchida
30048222f2
Consider a multi-lined array as a block-like expression
2018-09-30 23:28:14 +09:00
Seiichi Uchida
e2b9c66cc9
Cargo fmt
2018-09-19 23:22:26 +09:00
Seiichi Uchida
76650174c7
Combine chain items only when the item will get orphaned
2018-09-19 23:20:43 +09:00
Ivan Molodetskikh
4b4fb557d7
Fix last chain item shape for Visual indent_style
2018-09-11 11:09:31 +03:00
Nick Cameron
a67208f212
Merge pull request #2986 from topecongiro/issue-2907
...
Handle chain w/ try operators with spaces
2018-09-03 13:10:50 +12:00
Seiichi Uchida
08e282877a
Handle raw identifiers in chain
2018-09-01 16:18:27 +09:00
Seiichi Uchida
20aac086d6
Simplify post-comment extraction
2018-08-31 18:20:28 +09:00
Seiichi Uchida
9df1dbe1ac
Use trim_tries to extract post comment over simple trim_matches
2018-08-31 18:20:28 +09:00
Seiichi Uchida
612f1af734
Use trim_tries to extract pre-comments over simple trim_matches
2018-08-31 18:20:28 +09:00
Seiichi Uchida
2880d59ec0
Add trim_tries
2018-08-31 18:20:25 +09:00
cad97
fc1909d311
Reformat
2018-08-23 17:14:19 -04:00
cad97
04d804c365
Rename CodeMap/FileMap to SourceMap/SourceFile
...
#2946
2018-08-23 17:10:46 -04:00
Seiichi Uchida
4bbfe0829d
Fix chain with many try operators
2018-08-05 21:03:45 +09:00
Seiichi Uchida
e6d814c423
Put comment between chain elements on its original position
2018-08-05 19:55:22 +09:00
Seiichi Uchida
3ec6de1de8
Add FIXME comment
2018-08-05 15:06:05 +09:00
Seiichi Uchida
49945a14f7
Format
2018-08-05 15:04:48 +09:00
Seiichi Uchida
9e113b5bab
Do not handle comment when converting try
...
As we get faulty span.
2018-08-05 15:03:36 +09:00
Seiichi Uchida
75967f0da2
Add a space before comment that comes after a block-like chain item
2018-08-05 14:37:13 +09:00
Seiichi Uchida
91c058a516
Veto putting a chain with comment in a single line
2018-08-05 14:34:34 +09:00
Seiichi Uchida
caefd218c9
Do not combine short parent and comment
2018-08-05 14:28:20 +09:00
Seiichi Uchida
e6bde923f5
Format comment between chain elements
2018-08-05 14:28:10 +09:00
Seiichi Uchida
844e878d12
Add Comment to ChainItemKind
2018-08-05 14:27:47 +09:00
Seiichi Uchida
fc3ea494ac
Make children list in-order
...
instead of working on reveresed list.
2018-08-05 13:54:28 +09:00
Seiichi Uchida
c480309aad
Get correct span
2018-08-05 13:35:33 +09:00
Seiichi Uchida
c20bf454c9
Add Span field to ChainItem
2018-08-05 13:02:24 +09:00
Seiichi Uchida
c5b36f53ae
Normalize chain elements
...
Instead of passing around a list of subexpressions ([`a`, `a.b`, `a.b.c`]),
we now use a list of chain element ([`a`, `.b`, `.c`]). This should make it
easier to extract comments between chain elements.
2018-08-05 11:45:05 +09:00
Nick Cameron
df4fb8a05b
Reformatting after rebase
2018-07-24 15:49:35 +12:00
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