David Lattimore
4a053f206f
Do not flatten match arm block with leading attributes
...
This is a backport of #4124 .
Fixes #4109
2021-12-29 17:43:58 -06:00
Caleb Cartwright
2a3635d5d1
tests: remove snippets with inner attrs on non-block expressions
2021-05-04 18:38:22 -05:00
Aaron Hill
46ab14437e
Don't flatten a block containing a single macro call
...
We no longer flatten a block that looks like this:
```rust
match val {
pat => { macro_call!() }
}
```
Currently, rust ignores trailing semicolons in macro expansion in
expression position (see https://github.com/rust-lang/rust/issues/33953 )
If this is changed, flattening a block with a macro call may break the
user's code - the trailing semicolon will no longer parse if the macro
call occurs immediately on the right-hand side of the match arm
(e.g. `pat => macro_call!()`)
2020-11-05 20:45:11 -06:00
Seiichi Uchida
783948fcbb
Fix handling of match arm's rewrite ( #3775 )
2019-09-05 11:15:46 +09:00
Seiichi Uchida
c0e616bc1d
Implement closing-block procedure without relying on missed_span module ( #3691 )
2019-07-17 23:07:12 +09:00
Stéphane Campinas
d03d9a45ef
end expressions like return/continue/break with a semicolon
...
Close #3213
2018-11-29 20:39:07 +01:00
Kevin Stenerson
bc5124e016
Always enforce exactly one space between macro!
and braces ({}
)
2018-11-17 11:53:11 -07:00
Matthias Krüger
b25f974c0d
fix a few typos found via codespell.
2018-10-19 12:28:00 +02:00
Nick Cameron
e2be62c7a5
Add test (issue 3005)
2018-10-15 14:09:31 +13:00
Seiichi Uchida
efe24bd7e7
Add a test for #3030
2018-10-01 00:06:37 +09:00
Seiichi Uchida
ec32c961d3
Add a test for #3040
2018-09-21 00:57:46 +09:00
Seiichi Uchida
594774b4e5
Update tests
2018-09-19 23:19:24 +09:00
Nick Cameron
4fa2969c39
fixup tests
2018-07-24 15:46:39 +12:00
Nick Cameron
be4d37da4b
Indent a match guard if the pattern is multiline
...
Closes #2377
2018-06-26 15:18:17 +12:00
Mike Baker
1d4b988414
Strip leading |
in match arm patterns
...
This addresses issue #2621
This commit turns out to be a partial revert of
ea3c01e337
The rationale is that a `|` character preceding a match pattern is not
semantically relevant and therefore should be considered a
style/formatting choice.
A discussion concluded that the best way to emit consistent formatting
here was to strip the leading `|`
This removes the match_with_beginning_vert test because it was asserting
the old behaviour which has been changed, it adds a new test
(issue_2621) which should be a more comprehensive check of the behavior
of `|` in match arms.
Discussion at https://github.com/rust-lang-nursery/fmt-rfcs/issues/119
2018-06-25 00:53:15 +01:00
Nick Cameron
51f566062f
Update uses of rustfmt_skip
to rustfmt::skip
2018-05-14 16:25:10 +12:00
Seiichi Uchida
48424ea765
Update tests and cargo fmt
2018-03-26 07:38:39 +09:00
Seiichi Uchida
5b9b7d5b9f
Do not collapse block around expr with condition on match arm
...
Closes #2376 .
2018-03-21 22:21:08 +09:00
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
topecongiro
a6d94b9842
Update tests
2017-11-29 17:37:56 +09:00
topecongiro
3bd1cc4fe0
Update a test for #1807
2017-11-16 17:43:06 +09:00
topecongiro
1c702aa252
Update tests
2017-11-16 17:43:06 +09:00
topecongiro
1dc9b927af
Update tests
2017-11-15 12:22:50 +09:00
topecongiro
bf775785e0
Add a test for #2151
2017-11-15 12:22:50 +09:00
topecongiro
00318c400b
Add a test for #2152
2017-11-15 10:36:42 +09:00
Seiichi Uchida
881c5b5a6d
Add a test for #2021
2017-11-11 23:14:01 +09:00
Martin Lindhe
f930a16b8d
fix some typos
2017-11-01 07:33:55 +01:00
Seiichi Uchida
792f48c976
Add a test for #2099
2017-10-30 23:37:26 +09:00
topecongiro
ff30782725
Update tests
2017-09-15 12:20:58 +09:00
Seiichi Uchida
5cf05a2992
Update tests
2017-08-18 23:20:12 +09:00
Seiichi Uchida
7268a50e36
Handle prefix and suffix try operators differently
2017-08-09 16:36:41 +09:00
topecongiro
6f24c64673
Update tests
2017-08-05 15:24:20 +09:00
Seiichi Uchida
36b347b123
Update tests
2017-07-31 16:24:18 +09:00
Seiichi Uchida
9777c0de93
Format source codes and update tests
2017-07-20 00:42:00 +09:00
Seiichi Uchida
b78b6e8b09
Format source codes and update tests
2017-07-20 00:42:00 +09:00
topecongiro
be55f856bb
Update tests
2017-07-11 21:53:48 +09:00
topecongiro
7cbc48ae32
Update tests
2017-07-10 16:52:55 +09:00
Seiichi Uchida
78224a0644
Update tests
2017-07-10 02:25:26 +09:00
topecongiro
9b73490491
Update tests
2017-06-17 15:26:59 +09:00
topecongiro
208ff15954
Format source codes
2017-06-16 08:49:49 +09:00
topecongiro
de10113c74
Update tests
...
Add more patterns and types
2017-06-15 16:55:31 +09:00
topecongiro
b8f11a4e3c
Format source codes
2017-06-14 20:39:07 +09:00
Nick Cameron
18ccd0190e
Rebasing
2017-06-13 14:49:47 +12:00
Nick Cameron
6f30d9e7c9
Reformat tests
2017-06-13 14:42:54 +12:00
topecongiro
57fc39305d
Put guard on newline if it exceeds max width
2017-06-12 17:25:38 +09:00
topecongiro
27da80324c
Implement catch
2017-06-06 07:32:06 +02:00
topecongiro
d16a0a399e
Implement 'vec![expr; expr]'
2017-05-23 11:32:09 +09:00
topecongiro
0248e9869d
Apply closure exception to match in args
2017-05-09 08:28:05 +09:00
Seiichi Uchida
19599b9a01
Use block when arm exceeds max_width
2017-05-02 10:15:31 +09:00