2279 Commits

Author SHA1 Message Date
topecongiro
b58a113370 Use UseSegment::Slf or UseSegment::Super when appropriate
Currently we `UseSegment::Ident` for all of the segments except the last.
E.g. `use super::foo::bar::self;` will be
`[Ident("super"), Ident("foo"), Ident("bar"), Self(None)]`.
in the current implementation. I think that this should be
`[Super(None), Ident("foo"), Ident("bar"), Self(None)]`.
instead.

I noticed this because some tests failed after updating
`rustc-ap-syntax` to 73.0.0.
2018-03-22 15:56:51 +09:00
topecongiro
846f4f21db Fix libsyntax updates
`ast::UseTreeKind::Simple` now takes `Option<ast::Ident>`
instead of `ast::Ident`.
2018-03-22 15:55:14 +09:00
topecongiro
51d5696977 Fix libsyntax update
Underscore is now one of keywords.
2018-03-22 15:53:43 +09:00
Alan Du
d402cd20a8 Close #2551 2018-03-22 00:57:22 -04:00
Alan Du
d8723aaa8c Fix build 2018-03-22 00:01:09 -04:00
Nick Cameron
ff9ab51617
Merge pull request #2550 from sinkuu/chars_count_index
Don't index a string with chars().count()/position()
2018-03-22 16:26:48 +13:00
Nick Cameron
0bc0241d2a
Merge pull request #2548 from topecongiro/match-mod
Do not collapse block around expr with condition on match arm
2018-03-22 15:40:36 +13:00
Shotaro Yamada
83c8d23cc2 Omit unnecessary UTF-8 decoding 2018-03-22 08:34:53 +09:00
Shotaro Yamada
e5572bbb66 Use take_while 2018-03-22 08:34:36 +09:00
Shotaro Yamada
4757321277 Don't index a string with chars().count() 2018-03-22 08:33:18 +09:00
Seiichi Uchida
5b9b7d5b9f Do not collapse block around expr with condition on match arm
Closes #2376.
2018-03-21 22:21:08 +09:00
Seiichi Uchida
88589f2ad8 Add matches module
`matches` module contains `rewrite_match` and related stuffs.
2018-03-21 22:21:08 +09:00
Nick Cameron
3a138a24a3 Return grouping extern crate to true by default 2018-03-20 09:54:00 +13:00
Nick Cameron
bf9f175336 reviewer comments and rebase fallout 2018-03-20 09:27:31 +13:00
Nick Cameron
0cf80dcce7 Better handle comments and newlines around erased imports 2018-03-20 09:27:31 +13:00
Nick Cameron
50c95a074a cargo fmt 2018-03-20 09:27:31 +13:00
Nick Cameron
4cfffbd0a8 Reimplement import reordering. 2018-03-20 09:27:31 +13:00
Nick Cameron
a76d9b529a format code and tests 2018-03-20 09:27:31 +13:00
Nick Cameron
164cf7d6c9 Reorder imports by default 2018-03-20 09:26:10 +13:00
Seiichi Uchida
adc257f4b3 Put a space before colon that appears after a meta variable
Closes #2534.
2018-03-19 08:27:53 +09:00
Seiichi Uchida
f8109f8e9c Put spaces around braces 2018-03-19 08:23:53 +09:00
Seiichi Uchida
96a83b57e5 Add some doc comments and factor out add_repeat and add_delimited 2018-03-19 08:23:53 +09:00
Seiichi Uchida
0fd174d5f1 Handle binary operators and lifetimes 2018-03-19 08:23:53 +09:00
Seiichi Uchida
3f7b59ca2b Break before meta variables when using multiple lines 2018-03-19 08:23:53 +09:00
Seiichi Uchida
95507e3a43 Remove has_prefix_space 2018-03-19 08:23:53 +09:00
Seiichi Uchida
ec71459c44 Format macro arguments with vertical layout 2018-03-19 08:23:53 +09:00
Seiichi Uchida
84ea306d32 Remove unit tests 2018-03-19 08:23:53 +09:00
Nick Cameron
56d2a08db0
Merge pull request #2541 from topecongiro/issue-2358
Skip name replacement in comments and strings
2018-03-19 08:55:35 +13:00
Seiichi Uchida
1a969cff7f Remove FIXME about duplicated code 2018-03-17 14:59:39 +09:00
Seiichi Uchida
d7188654ea Skip name replacement in comments and strings 2018-03-17 14:59:26 +09:00
Seiichi Uchida
ca6fc67e60 Fix print_version 2018-03-17 12:16:15 +09:00
topecongiro
a03b3b7d6f Cargo update
Remove `rustc-ap-rustc_errors` from dependencies since it
is re-exported from `rustc-ap-syntax`.
2018-03-16 08:52:36 +09:00
Nick Cameron
c416246494
Merge pull request #2509 from topecongiro/issue-2493
Overflow the last rhs of a binary expression
2018-03-16 07:30:30 +13:00
Seiichi Uchida
eda626cfc9 Call syntax::with_globals before using a parser 2018-03-15 18:55:52 +09:00
Matthew McAllister
c5168405b0 Format attributes on block expressions 2018-03-14 01:16:19 +09:00
Nick Cameron
a0e063a6e1
Merge pull request #2522 from topecongiro/ignore-config-option
Add ignore config option
2018-03-12 16:25:31 +13:00
topecongiro
3999d64f12 Simplify IgnoreList 2018-03-12 08:41:19 +09:00
Seiichi Uchida
182b46e0ed Simplify join_bounds() 2018-03-12 07:57:03 +09:00
Seiichi Uchida
ccd134ed75 Add a test for #2497
Closes #2497.
2018-03-12 07:54:12 +09:00
Seiichi Uchida
b077297179 Modify the placement of the opening brace of trait
Put the opening brace on the next line if

1. putting it one the current line exceeds max width.
2. trait bounds uses multiple lines.
2018-03-12 07:54:12 +09:00
Seiichi Uchida
f56039c7e5 Use rewrite_assign_rhs for rewriting bounds 2018-03-12 07:54:12 +09:00
Seiichi Uchida
8f7a90fbef Add rewrite_assign_rhs_with
It is like `rewrite_assign_rhs` but lets us force to put the rhs on the next
line if it uses multiple lines.

This lets us avoid duplicating logic for choosing whether to put stuff on the
same line or the next line.
2018-03-12 07:48:31 +09:00
Nick Cameron
f5ebcd922e
Merge pull request #2513 from rtsuk/master
Restore cargo fmt behavior in workspaces
2018-03-12 11:26:12 +13:00
Nick Cameron
bcaeab7a5e
Merge pull request #2527 from topecongiro/issue-2526
Check whether '\\'' is char literal or lifetime
2018-03-12 11:25:40 +13:00
Nick Cameron
af5d3cc87b
Merge pull request #2524 from topecongiro/issue-2523
Do not unindent code block in comments with unformattable macro
2018-03-12 11:21:09 +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
86a427fe32 Check whether '\\'' is char literal or lifetime 2018-03-10 01:19:38 +09:00
Rob Tsuk
ba10a4c48d Canonicalise the paths 2018-03-09 07:24:40 -07:00
Rob Tsuk
53dcb0d09d Restore cargo fmt behavior in workspaces
Previously, cargo fmt  invoked without parameters would
only format the crate in the current directory, even if
the crate was part of a workspace. This patch restores
that behavior.
2018-03-09 07:24:40 -07:00