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
topecongiro
2188b464b0
Format macro call with item arguments
2018-03-09 17:17:55 +09:00
Seiichi Uchida
6ba7c34433
Use Option<SeparatorTactic> over bool to control trailing comma
2018-03-09 14:07:43 +09:00
Seiichi Uchida
ae629abc41
Add overflow module
...
This commit adds `overflow` module. This module provides two APIs.
`rewrite_with_parens` is basically the same as `rewrite_call_inner`.
`rewrite_with_angle_brackets` is used for rewriting generics and types.
2018-03-09 14:07:43 +09:00
Shotaro Yamada
b3fa50db73
Use nested_shape for indenting types of lazy_static
2018-03-07 10:51:28 +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
Ingvar Stepanyan
8691c64e99
cargo run cargo-fmt
...
Reformat codebase with current version to pass self_tests (formats macros without repetitions).
2018-02-04 12:09:03 +00:00
Ingvar Stepanyan
d8c154f052
Extract branch rewrite function
2018-02-04 11:55:08 +00:00
Ingvar Stepanyan
571af9d4b1
Format
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
bc9185451d
Move ; between macro branches to a separator
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
6377c52233
Fix comment handling in macros
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
70e7716262
Comments WIP
2018-02-04 11:54:03 +00:00
Ingvar Stepanyan
41c393c751
Keep delimiter as part of macro args list
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9423cdba82
Omit newline for empty macro branches
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
5bd036fcac
Optimise common => {{
macro pattern
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
1b9fd01343
Support compact macros 2.0 representation
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
5d973d2e8c
Initial support for macros 1.1
2018-02-04 11:53:09 +00:00
Seiichi Uchida
61b23a4293
Skip rewriting macro def with repeat
2018-02-04 08:52:50 +09:00
Seiichi Uchida
dfc67a5df7
Cargo clippy
2018-01-26 14:53:28 +09:00
Nick Cameron
1ced6d1037
Minor refactoring in macros.rs
2018-01-11 17:40:05 +13:00
Nick Cameron
aa758d671f
Better handling of comments in macro defs
2018-01-03 20:36:52 +13:00
Nick Cameron
f86f6dcd9c
Format some macros 2.0 macro defs
...
cc #1539
2018-01-01 19:51:54 +13:00
Seiichi Uchida
516f15aba1
Cargo clippy
2017-12-12 13:48:12 +09:00
Nick Cameron
08022ec1a3
Merge pull request #2265 from topecongiro/issue-2262
...
Fix bugs related to closures
2017-12-11 09:00:56 +13:00
Seiichi Uchida
90383d7426
Do not set inside_macro flag when converting try!() to '?'
...
This will keep rustfmt idempotent when using 'use_try_shorthand' config option.
2017-12-10 21:53:01 +09:00
Seiichi Uchida
5624175574
Format macro in pattern position
2017-12-10 00:22:00 +09:00
Seiichi Uchida
3ebe054362
Replace into() on &str with to_owned()
2017-12-08 13:07:42 +09:00
Seiichi Uchida
7c4a84751f
Convert '&str' into 'String' whenever necessary
2017-12-07 13:57:52 +09:00
Nick Cameron
db81a7f669
Merge pull request #2216 from topecongiro/issue-2214
...
Preserve trailing comma on array inside macro call
2017-12-01 12:18:38 +13:00
topecongiro
65cb9b4649
Generalize rewrite_array() to types other than ast::Expr
2017-11-30 22:13:28 +09:00
topecongiro
22c9025027
Format source codes
2017-11-30 18:00:49 +09:00
Nick Cameron
dd1fbca99a
Replace various small width heuristics with a single option
...
Closes #1984
2017-11-24 20:17:06 +13:00
topecongiro
bc543cce0b
Combine spaces_within_parens and spaces_within_brackets
2017-11-14 23:42:31 +09:00
topecongiro
b023cc831c
Remove static lifetime
2017-11-06 13:52:25 +09:00
topecongiro
6c5ac5a9b3
Remove needless borrows
2017-11-06 13:52:25 +09:00
Martin Lindhe
f930a16b8d
fix some typos
2017-11-01 07:33:55 +01:00
topecongiro
fe69dde96b
Replace 'try_opt!' macro with a '?' operator
2017-10-05 20:50:19 +09:00
topecongiro
436a083fce
Change return type of rewrite_call_inner() to Option<String>
2017-09-28 16:33:30 +09:00
Seiichi Uchida
df7d2be562
Move Indent and Shape to shape.rs from lib.rs
2017-09-19 10:04:35 +09:00
Nick Cameron
cccb7f681e
Merge pull request #1966 from topecongiro/string-to-cow
...
Refactoring: use Cow and etc.
2017-09-18 12:45:25 +12:00
topecongiro
f0580ae91a
Use Cow to avoid unnecessary allocation
2017-09-15 18:21:06 +09:00
topecongiro
0b3b89d51f
Remove unnecessary return
2017-09-15 17:09:45 +09:00
topecongiro
f51261e93e
Cargo fmt
2017-09-15 12:10:58 +09:00
Nick Cameron
59d1e84259
Merge pull request #1937 from topecongiro/enhance-macro-rewrite
...
Enhance macro rewrite
2017-08-31 17:43:52 +12:00
topecongiro
848d4559e1
Enhance macro rewrite
2017-08-31 13:52:13 +09:00
Seiichi Uchida
4b79055a15
Apply refactoring from cargo clippy
2017-08-31 12:49:12 +09:00
Vadim Petrochenkov
6e5c6f5ba3
Use getters to access Span
fields
2017-08-31 14:14:13 +12:00
topecongiro
343b315830
Handle macros with tabs
2017-08-27 13:44:49 +09:00