Skip to content

Commit f44a5ed

Browse files
committed
Update tests
- We no longer normalize number of vertical spaces between statements. - Add a test
1 parent 8fb4fa5 commit f44a5ed

12 files changed

+92
-3
lines changed

Configurations.md

-3
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,11 @@ fn bar() {
164164
#### `1`
165165
```rust
166166
fn foo() {
167-
168167
println!("a");
169168
}
170169

171170
fn bar() {
172-
173171
println!("b");
174-
175172
println!("c");
176173
}
177174
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// rustfmt-blank_lines_lower_bound: 2
2+
// rustfmt-blank_lines_upper_bound: 3
3+
4+
#[foo]
5+
fn foo() {
6+
println!("a");
7+
}
8+
#[bar]
9+
#[barbar]
10+
fn bar() {
11+
println!("b");
12+
println!("c");
13+
}
14+
struct Foo {}
15+
enum Bar {}
16+
use std::io;
17+
extern crate foobar;
18+
extern crate foo;
19+
extern crate bar;
20+
trait Foo = Bar;
21+
impl Foo {}
22+
mac!();
23+
#[temp]
24+
use std::fs;
25+
use std::alloc;
26+
use std::ascii;

tests/target/assignment.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fn main() {
1616
single_line_fit = 5;
1717
single_lit_fit >>= 10;
1818

19+
1920
// #2791
2021
let x = 2;
2122
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// rustfmt-blank_lines_lower_bound: 2
2+
// rustfmt-blank_lines_upper_bound: 3
3+
4+
5+
#[foo]
6+
fn foo() {
7+
println!("a");
8+
}
9+
10+
11+
#[bar]
12+
#[barbar]
13+
fn bar() {
14+
println!("b");
15+
println!("c");
16+
}
17+
18+
19+
struct Foo {}
20+
21+
22+
enum Bar {}
23+
24+
25+
use std::io;
26+
27+
28+
extern crate bar;
29+
extern crate foo;
30+
extern crate foobar;
31+
32+
33+
trait Foo = Bar;
34+
35+
36+
impl Foo {}
37+
38+
39+
mac!();
40+
41+
42+
use std::alloc;
43+
use std::ascii;
44+
#[temp]
45+
use std::fs;

tests/target/control-brace-style-always-next-line.rs

+4
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,28 @@ fn main() {
77
let bar = ();
88
}
99

10+
1011
'label: loop
1112
// loop comment
1213
{
1314
let foo = ();
1415
}
1516

17+
1618
cond = true;
1719
while cond
1820
{
1921
let foo = ();
2022
}
2123

24+
2225
'while_label: while cond
2326
{
2427
// while comment
2528
let foo = ();
2629
}
2730

31+
2832
for obj in iter
2933
{
3034
for sub_obj in obj

tests/target/control-brace-style-always-same-line.rs

+4
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@ fn main() {
44
let bar = ();
55
}
66

7+
78
'label: loop
89
// loop comment
910
{
1011
let foo = ();
1112
}
1213

14+
1315
cond = true;
1416
while cond {
1517
let foo = ();
1618
}
1719

20+
1821
'while_label: while cond {
1922
// while comment
2023
let foo = ();
2124
}
2225

26+
2327
for obj in iter {
2428
for sub_obj in obj {
2529
'nested_while_label: while cond {

tests/target/else-if-brace-style-always-next-line.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ fn main() {
1414
let bar = ();
1515
}
1616

17+
1718
let a = if 0 > 1 { unreachable!() } else { 0x0 };
1819

20+
1921
if true
2022
{
2123
let foo = ();

tests/target/else-if-brace-style-always-same-line.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ fn main() {
1111
let bar = ();
1212
}
1313

14+
1415
let a = if 0 > 1 { unreachable!() } else { 0x0 };
1516

17+
1618
if true {
1719
let foo = ();
1820
} else if false {

tests/target/else-if-brace-style-closing-next-line.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ fn main() {
1313
let bar = ();
1414
}
1515

16+
1617
let a = if 0 > 1 { unreachable!() } else { 0x0 };
1718

19+
1820
if true {
1921
let foo = ();
2022
}

tests/target/extern.rs

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ extern "C" {
7474
file: *mut FILE,
7575
) -> *mut FILE;
7676

77+
7778
async fn foo() -> *mut Bar;
7879
const fn foo() -> *mut Bar;
7980
unsafe fn foo() -> *mut Bar;

tests/target/multiple.rs

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ fn main() {
129129
println!("{}", i);
130130
}
131131

132+
132133
while true {
133134
hello();
134135
}

tests/target/remove_blank_lines.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
fn main() {
22
let x = 1;
33

4+
45
let y = 2;
56

7+
68
println!("x + y = {}", x + y);
79
}
810

@@ -20,9 +22,11 @@ fn bar() {
2022
let x = 1;
2123
// comment after statement
2224

25+
2326
// comment before statement
2427
let y = 2;
2528
let z = 3;
2629

30+
2731
println!("x + y + z = {}", x + y + z);
2832
}

0 commit comments

Comments
 (0)