Seiichi Uchida
d45aa55bd6
Remove nested parens
...
And make sure that we do not remove comments within parens.
2018-03-08 20:25:18 +09:00
Seiichi Uchida
a6b574bfa7
Cargo update and cargo clippy
2018-03-08 18:10:23 +09:00
moe
a2f861730e
fix adds a trailing comma to struct-like macro ( #2490 )
...
* fix adds a trailing comma to struct-like macro
2018-03-08 18:05:39 +09:00
Seiichi Uchida
9889678f56
Replace Option<Vec<&'a ast::pat>> with Vec<&'a ast::Pat>
2018-03-08 12:56:28 +09:00
Seiichi Uchida
3f0b630845
Support parentheses in patterns
2018-03-06 20:07:09 +09:00
Seiichi Uchida
520f0d65ef
Format multiple patterns in 'if let' and `while let'
...
Closes #2511 .
2018-03-06 20:02:04 +09:00
Seiichi Uchida
d7495324bc
Work around removal of beginning_vert field from ast::Arm
...
`ast::Arm` used to have `beginning_vert` field whose type is `Option<Span>`
and holds a span of the beginning `|` if available. This field is now removed.
This commit works around that.
Since we only need a `BytePos` of the `|`, the type of `beginning_vert` in
`ArmWrapper` is `Option<BytePos>`.
2018-03-06 19:56:49 +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
Nick Cameron
b7f01769f9
Merge branch 'master' into init-shorthand
2018-02-01 15:20:01 +13:00
csmoe
28bb16a5a0
add a support for immovable generators
2018-01-30 22:14:33 +08:00
Seiichi Uchida
c9c346a89f
Add 'use_field_init_shorthand' config option
2018-01-29 22:15:20 +09:00
Seiichi Uchida
7d63490d85
Update to the latest libsyntax changes
2018-01-29 21:44:26 +09:00
Seiichi Uchida
154bf8e1af
Cargo fmt
2018-01-22 13:05:18 +09:00
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