Nick Cameron
4f522794ae
Tidy up and pass tests
2018-03-02 15:07:13 +13:00
topecongiro
4af2aa3a9e
Create rustfmt_core crate
2018-02-07 22:48:05 +09:00
Ingvar Stepanyan
9423cdba82
Omit newline for empty macro branches
2018-02-04 11:53:10 +00:00
Ingvar Stepanyan
9fca9073d9
Revert comments
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
9318b4d2cf
Update some macro tests
2018-02-04 11:53:10 +00:00
Seiichi Uchida
61b23a4293
Skip rewriting macro def with repeat
2018-02-04 08:52:50 +09:00
Seiichi Uchida
298f29a57d
Do not panic when special macros have less args than expected
2018-01-18 00:50:16 +09:00
Nick Cameron
9368de276c
Merge pull request #2327 from nrc/macro-defs
...
Some macros 2.0 macro defs
2018-01-04 14:02:37 +13:00
Nick Cameron
aa758d671f
Better handling of comments in macro defs
2018-01-03 20:36:52 +13:00
Nick Cameron
47d9ccd6a1
Tests for formatting macro 2.0 defs
2018-01-01 19:51:54 +13:00
David Wood
39e2f43f91
Split assert_eq! if any arguments are not simple
2017-12-27 21:19:42 +00: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
Seiichi Uchida
0909ecbac7
Add tests for macro in pattern position
2017-12-10 00:21:49 +09:00
David Alber
9a25458179
Adding tests for assert!
, write!
, and writeln!
2017-12-06 22:42:33 -08: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
David Alber
8c51122f54
Adding tests for all specially-formatted format!
-like macros
2017-12-05 16:56:36 -08:00
Seiichi Uchida
289b5f4c21
Update a test
2017-12-05 08:44:26 +09:00
Seiichi Uchida
ab8129069a
Add a test for #1209
2017-12-05 08:41:10 +09:00
topecongiro
16184d3e16
Cargo fmt and update a test
2017-12-03 11:34:18 +09:00
topecongiro
72cac8beae
Add a test for special case macros like format! and assert!
2017-12-03 11:34:18 +09:00
topecongiro
5aaa00a929
Add a test for #2214
2017-11-30 22:12:55 +09:00
topecongiro
daf4789b76
Add a test for #2087
2017-10-27 16:35:40 +09:00
topecongiro
00f8610d9b
Add a test
2017-10-05 19:44:45 +09:00
topecongiro
848d4559e1
Enhance macro rewrite
2017-08-31 13:52:13 +09: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
2376582dfb
Update tests
2017-08-11 17:54:20 +09:00
Seiichi Uchida
a8b0a6e4c5
Format source codes and update tests
2017-07-20 00:42:00 +09:00
topecongiro
a4cce31ea9
Update tests
2017-07-07 09:04:06 +09:00
topecongiro
6a7f866cfe
Format source codes
2017-07-05 18:12:43 +09:00
topecongiro
eeb5599b4b
Do not add trailing comma inside macro invocation unless there already is
2017-06-23 13:43:43 +09:00
topecongiro
f062544cdd
Update tests inside macro.rs
...
I moved around some tests in order to prevent rustfmt from failing to format
tests after macro invocations whose arguments cannot be parsed as expressions.
2017-06-23 13:03:37 +09:00
Seiichi Uchida
6afb0e856c
Avoid line break when rhs of assignment is an invalid macro
2017-06-18 14:25:21 +09:00
topecongiro
b8f11a4e3c
Format source codes
2017-06-14 20:39:07 +09:00
Nick Cameron
6f30d9e7c9
Reformat tests
2017-06-13 14:42:54 +12:00
Nick Cameron
b79094262f
Merge pull request #1604 from topecongiro/comment-group
...
Format comments with different opening in different manner
2017-05-30 08:53:22 +12:00
topecongiro
72c04facd2
Add tests for issues which can be closed on the current master
...
This PR adds tests for #325 , #1092 , #1214 , #1278 , #1329 and #1427 .
2017-05-28 13:24:05 +09:00
topecongiro
99c2eab5ac
Allow attributes on expressions
2017-05-28 11:44:41 +09:00
topecongiro
e3eec44690
Return original snippet when macro contains invalid syntax
2017-05-24 07:24:31 +09:00
topecongiro
dc8d3aa23a
Update tests
2017-05-23 11:39:31 +09:00
topecongiro
d16a0a399e
Implement 'vec![expr; expr]'
2017-05-23 11:32:09 +09:00
Seiichi Uchida
79ba34c607
Use offset_left for rewrite_unary_prefix
2017-05-15 22:55:01 +09:00
Nick Cameron
49e86a1e65
Handle semicolons in macro statements
...
Fixes #1279
2017-01-18 10:38:46 +13:00
Nick Cameron
846d7ad387
make rustfmt-normalize_comments false by default
2017-01-16 14:50:27 +13:00
Bekh-Ivanov Aleksey
935286755c
Stripping trailing commas and spaces from vec!
elements ( #1219 )
...
* Stripping trailing commas and spaces from `vec!` elements
* Stripping trailing commas and spaces ONLY from `vec!` elements
* Added comment
2016-11-14 17:42:15 +13:00
Philip Craig
c4a7a7108e
Preserve macro formatting if we can't rewrite it
2016-10-03 14:14:56 +10:00
Nick Cameron
9188ec0f7f
Bail out on recovered errors. ( #965 )
...
Closes #915
Closes #930
Closes #931
2016-04-27 21:08:44 +02:00