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
topecongiro
24efc3a934
Ignore empty lines inside arguments of macro with brace
2017-08-25 22:35:22 +09:00
Seiichi Uchida
a18a40cbc1
Add indent to macro we could not format
2017-08-21 23:19:01 +09:00
topecongiro
840edb2c4f
Remove 'mut' notation
2017-08-11 17:54:38 +09:00
topecongiro
6fd291981e
Sort imports in alphabetical and consistent order
2017-07-13 18:42:14 +09:00
topecongiro
e3310a6a18
Format source codes
2017-07-11 21:53:10 +09:00
topecongiro
60f0c576c9
Preserve trailing comma of macro invocation
2017-06-23 12:59:47 +09:00
topecongiro
54233acc8e
Format source codes
2017-06-17 16:56:54 +09:00
topecongiro
4a5871eccc
Use correct indentaion for vec! with semicolon
2017-06-16 13:57:37 +09:00
topecongiro
8955eb86e6
Direct format vec! instead of using rewrite_pair
2017-06-14 20:33:54 +09:00
Nick Cameron
1f512948a0
Reformat source code using new defaults
2017-06-13 14:41:49 +12:00
est31
727963afe4
Update syntex_syntax
...
Bases on commit to switch to libsyntax by @nrc
2017-06-06 07:31:47 +02:00
topecongiro
a9f529cba4
Format source codes
2017-06-04 19:35:29 +09:00
Seiichi Uchida
10c3632078
Format source codes
2017-06-01 12:08:25 +09:00
topecongiro
86856491bc
Format source codes
2017-05-25 16:08:08 +09:00
Nick Cameron
393ba27311
Remove dependency on Itertools
2017-05-25 16:23:07 +12:00
Nick Cameron
93c556c6ba
Merge pull request #1578 from topecongiro/poor/macro
...
Use original code snippet for macro which contains invalid syntax
2017-05-24 11:43:10 +12:00
topecongiro
e3eec44690
Return original snippet when macro contains invalid syntax
2017-05-24 07:24:31 +09:00
topecongiro
04bb5d8929
Format source codes
2017-05-24 00:07:02 +09:00
topecongiro
13af774e55
Fix weird indentaion in chain
2017-05-23 11:37:12 +09:00
topecongiro
d16a0a399e
Implement 'vec![expr; expr]'
2017-05-23 11:32:09 +09:00
Michael Killough
c3c2e823cb
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt into config
2017-05-18 13:05:19 +07:00
topecongiro
d7b6f1199f
Format source codes
2017-05-16 23:24:38 +09:00
Michael Killough
c0bdbfa531
Switch to accessing config items via method.
...
Preparation for #865 , which proposes adding a flag which outputs which
config options are used during formatting.
This PR should not make any difference to functionality. A lot of this
was search-and-replace.
Some areas worthy of review/discussion:
- The method for each config item returns a clone of the underlying
value. We can't simply return an immutable reference, as lots of
places in the code expect to be able to pass the returned value as
`bool` (not `&bool). It would be nice if the `bool` items could
return a copy, but the more complex types a borrowed reference... but
unfortunately, I couldn't get the macro to do this.
- A few places (mostly tests and `src/bin/rustfmt.rs`) were overriding
config items by modifying the fields of the `Config` struct directly.
They now use the existing `override_value()` method, which has been
modified to return a `Result` for use by `src/bin/rustfmt.rs`. This
benefits of this are that the complex `file_lines` and `write_mode`
strings are now parsed in one place (`Config.override_value`) instead
of multiple. The disadvantages are that it moves the compile-time
checks for config names to become run-time checks.
2017-05-16 15:47:09 +07:00