Seiichi Uchida
fa6892eb63
Use field initialization shorthand if possible
...
Also this PR fixes a bug that attributes on a shorthand field get removed.
2018-01-22 13:04:20 +09:00
Seiichi Uchida
298f29a57d
Do not panic when special macros have less args than expected
2018-01-18 00:50:16 +09:00
Chris Stinson
4c4e079613
Fixing binop_separator="Back" for ranges
...
Hardcoded Separator::Place=Front in call to rewrite_pair for range
caused binop_separator="Back" to be hendled incorrectly
Fixed rewrite_pair call and the example in Configuration.md showing
the faulty behaviour
2018-01-16 17:50:20 +13:00
Seiichi Uchida
590857db37
Reformat a nested function call with a single newline using larger budget
2018-01-10 17:15:02 +09:00
David Alber
d981fb89c0
Removing unused name
2018-01-09 19:56:46 -08:00
David Wood
39e2f43f91
Split assert_eq! if any arguments are not simple
2017-12-27 21:19:42 +00:00
David Wood
0291331203
Add documentation to expr::SPECIAL_MACRO_WHITELIST
2017-12-24 12:27:07 +00:00
David Wood
3320b400ae
Merge branch 'master' of https://github.com/rust-lang-nursery/rustfmt
2017-12-24 12:01:59 +00: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
David Wood
ef8b2efd13
Fix off-by-one error in assert_eq! line wrapping
...
If two really long conditions are checked for equality, they wouldn't be split
into multiple lines if the last condition is the one to push the line past the
width limit.
Fix the off-by-one error that caused this, and add a test-case for it.
2017-12-23 01:32:55 +00:00
David Wood
e343521276
Add assert_eq! to special-cased macros
...
Allows for this form of assert_eq! macros:
```rust
assert_eq!(
left.id, right.id,
"IDs are not equal: {:?} {:?}",
left, right
);
```
Also allows for assert! macros to have the format arguments split across
multiple lines even if the assert condition is not simple:
```rust
assert!(
result >= 42,
"The result must be at least 42: {:?}",
result, result.code, context
);
```
2017-12-23 01:06:17 +00:00
Nick Cameron
723b938057
Merge pull request #2291 from topecongiro/issue-2289
...
Take the width of block's prefix into account only once
2017-12-22 12:58:02 +13:00
topecongiro
1d8619d49a
Fix wrong indentation on type alias
...
Use rewrite_assign_rhs() when rewriting type alias.
2017-12-21 09:58:13 +09:00
topecongiro
366ff40ae7
Take the width of block's prefix into account only once
2017-12-20 15:44:11 +09:00
Seiichi Uchida
516f15aba1
Cargo clippy
2017-12-12 13:48:12 +09:00
Nick Cameron
fc52a4d33f
Merge pull request #2173 from topecongiro/assignment-with-100-chars
...
Assignment whose lhs has 100 chars
2017-12-11 17:04:41 +13: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
b29a3afb96
Fix indentation in multi lined pattern
2017-12-10 23:54:34 +09: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
Nick Cameron
97fd517593
Merge pull request #2247 from topecongiro/optimize-snippet
...
Optimize snippet()
2017-12-08 20:39:01 +13:00
Seiichi Uchida
3ebe054362
Replace into() on &str with to_owned()
2017-12-08 13:07:42 +09:00
Seiichi Uchida
23fa0bc3ef
Merge pull request #2240 from davidalber/revisit-2219
...
Adding `print!` to the list of specially-formatted `format!`-like macros
2017-12-07 17:37:01 +09:00
David Alber
0f561a1447
Moving panic!
into the list of macros from the Standard Library
2017-12-06 22:23:02 -08:00
Seiichi Uchida
c0eb8c3212
Add FmtVisitor::from_context()
2017-12-07 13:57:54 +09:00
Seiichi Uchida
7c4a84751f
Convert '&str' into 'String' whenever necessary
2017-12-07 13:57:52 +09:00
Seiichi Uchida
69a15b2eee
Update FmtVisitor::from_codemap()
2017-12-06 22:51:52 +09:00
Nick Cameron
b07e4339f0
Merge pull request #2221 from topecongiro/rfc/blank-lines
...
Keep vertical spaces between items or statements within range
2017-12-06 15:52:19 +13:00
David Alber
eb42956e84
Adding print!
specially-formatted format!
-like macros list
...
This commit corrects what appears to be an accidental inclusion of
`panic!` twice in the list resulting from the union of ffbe52e and
aeb3398.
2017-12-05 16:56:56 -08:00
Seiichi Uchida
228578b9c7
Add count_newlines() utility function
2017-12-05 15:17:40 +09:00
topecongiro
1684df6a0a
Compress an array with simple items
2017-12-04 12:07:06 +09:00
topecongiro
8cf99b1d90
Factor out array_tactic
2017-12-04 12:06:46 +09:00
Seiichi Uchida
aeb33986b1
Add macros from the log crate to whitelist
2017-12-03 11:37:55 +09:00
topecongiro
8f395bd953
Cargo fmt
2017-12-03 11:34:18 +09:00
topecongiro
27a540db47
Factor out a mess
2017-12-03 11:34:18 +09:00
topecongiro
16184d3e16
Cargo fmt and update a test
2017-12-03 11:34:18 +09:00
topecongiro
0f5dcc665d
Handle special-case macros
2017-12-03 11:34:18 +09:00
topecongiro
ffbe52eb76
Add whitelists of macros that need special-case format
2017-12-03 11:34:18 +09:00
Nick Cameron
8f6b6c28f7
Merge pull request #2210 from topecongiro/issue-2178
...
Combine a short callee and a single argument
2017-12-01 15:02:16 +13: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
Nick Cameron
c18ba569df
Merge pull request #1889 from topecongiro/match-arm
...
Do not put if on the same line as match arm
2017-12-01 11:56:01 +13:00
topecongiro
b33df45d04
Look for trailing comma on array and preserve it inside macro call
2017-11-30 22:14:06 +09:00
topecongiro
65cb9b4649
Generalize rewrite_array() to types other than ast::Expr
2017-11-30 22:13:28 +09:00
Seiichi Uchida
8116e3491d
Cargo fmt & update a test
2017-11-30 18:07:10 +09:00
topecongiro
22c9025027
Format source codes
2017-11-30 18:00:49 +09:00
topecongiro
89bf00986d
Do not put if on the same line as match arm
2017-11-30 17:56:29 +09:00
Oliver Schneider
9667cc2484
Address clippy lints
2017-11-30 09:24:10 +01:00
topecongiro
39d85b0d41
Combine a sigle argument and a short callee
2017-11-30 15:00:32 +09:00
Seiichi Uchida
f99b775de7
Rename is_dummy to has_braces
2017-11-30 06:40:29 +09:00
Seiichi Uchida
1323abf93f
Fix a typo
2017-11-30 06:13:42 +09:00