Skip to content

Commit d0717d1

Browse files
committed
Auto merge of #3819 - mikerite:rustfmt-formatting-tests, r=phansch
Add [rustfmt::skip] to formatting lint tests
2 parents 47e93ff + 7fd0fbf commit d0717d1

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

ci/base-tests.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ rustup override set nightly
5959
# avoid loop spam and allow cmds with exit status != 0
6060
set +ex
6161

62-
for file in `find tests -not -path "tests/ui/formatting.rs" -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
62+
for file in `find tests -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
6363
rustfmt ${file} --check
6464
if [ $? -ne 0 ]; then
6565
echo "${file} needs reformatting!"

tests/ui/formatting.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
#![allow(clippy::if_same_then_else)]
55
#![allow(clippy::deref_addrof)]
66

7-
fn foo() -> bool { true }
7+
fn foo() -> bool {
8+
true
9+
}
810

11+
#[rustfmt::skip]
912
fn main() {
1013
// weird `else` formatting:
1114
if foo() {

tests/ui/formatting.stderr

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this looks like an `else {..}` but the `else` is missing
2-
--> $DIR/formatting.rs:12:6
2+
--> $DIR/formatting.rs:15:6
33
|
44
LL | } {
55
| ^
@@ -8,31 +8,31 @@ LL | } {
88
= note: to remove this lint, add the missing `else` or add a new line before the next block
99

1010
error: this looks like an `else if` but the `else` is missing
11-
--> $DIR/formatting.rs:16:6
11+
--> $DIR/formatting.rs:19:6
1212
|
1313
LL | } if foo() {
1414
| ^
1515
|
1616
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
1717

1818
error: this looks like an `else if` but the `else` is missing
19-
--> $DIR/formatting.rs:23:10
19+
--> $DIR/formatting.rs:26:10
2020
|
2121
LL | } if foo() {
2222
| ^
2323
|
2424
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
2525

2626
error: this looks like an `else if` but the `else` is missing
27-
--> $DIR/formatting.rs:31:10
27+
--> $DIR/formatting.rs:34:10
2828
|
2929
LL | } if foo() {
3030
| ^
3131
|
3232
= note: to remove this lint, add the missing `else` or add a new line before the second `if`
3333

3434
error: this is an `else {..}` but the formatting might hide it
35-
--> $DIR/formatting.rs:40:6
35+
--> $DIR/formatting.rs:43:6
3636
|
3737
LL | } else
3838
| ______^
@@ -42,7 +42,7 @@ LL | | {
4242
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
4343

4444
error: this is an `else {..}` but the formatting might hide it
45-
--> $DIR/formatting.rs:45:6
45+
--> $DIR/formatting.rs:48:6
4646
|
4747
LL | }
4848
| ______^
@@ -53,7 +53,7 @@ LL | | {
5353
= note: to remove this lint, remove the `else` or remove the new line between `else` and `{..}`
5454

5555
error: this is an `else if` but the formatting might hide it
56-
--> $DIR/formatting.rs:51:6
56+
--> $DIR/formatting.rs:54:6
5757
|
5858
LL | } else
5959
| ______^
@@ -63,7 +63,7 @@ LL | | if foo() { // the span of the above error should continue here
6363
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
6464

6565
error: this is an `else if` but the formatting might hide it
66-
--> $DIR/formatting.rs:56:6
66+
--> $DIR/formatting.rs:59:6
6767
|
6868
LL | }
6969
| ______^
@@ -74,7 +74,7 @@ LL | | if foo() { // the span of the above error should continue here
7474
= note: to remove this lint, remove the `else` or remove the new line between `else` and `if`
7575

7676
error: this looks like you are trying to use `.. -= ..`, but you really are doing `.. = (- ..)`
77-
--> $DIR/formatting.rs:97:6
77+
--> $DIR/formatting.rs:100:6
7878
|
7979
LL | a =- 35;
8080
| ^^^^
@@ -83,23 +83,23 @@ LL | a =- 35;
8383
= note: to remove this lint, use either `-=` or `= -`
8484

8585
error: this looks like you are trying to use `.. *= ..`, but you really are doing `.. = (* ..)`
86-
--> $DIR/formatting.rs:98:6
86+
--> $DIR/formatting.rs:101:6
8787
|
8888
LL | a =* &191;
8989
| ^^^^
9090
|
9191
= note: to remove this lint, use either `*=` or `= *`
9292

9393
error: this looks like you are trying to use `.. != ..`, but you really are doing `.. = (! ..)`
94-
--> $DIR/formatting.rs:101:6
94+
--> $DIR/formatting.rs:104:6
9595
|
9696
LL | b =! false;
9797
| ^^^^
9898
|
9999
= note: to remove this lint, use either `!=` or `= !`
100100

101101
error: possibly missing a comma here
102-
--> $DIR/formatting.rs:110:19
102+
--> $DIR/formatting.rs:113:19
103103
|
104104
LL | -1, -2, -3 // <= no comma here
105105
| ^
@@ -108,7 +108,7 @@ LL | -1, -2, -3 // <= no comma here
108108
= note: to remove this lint, add a comma or write the expr in a single line
109109

110110
error: possibly missing a comma here
111-
--> $DIR/formatting.rs:114:19
111+
--> $DIR/formatting.rs:117:19
112112
|
113113
LL | -1, -2, -3 // <= no comma here
114114
| ^

0 commit comments

Comments
 (0)