Skip to content

Commit a2c890f

Browse files
Make fmt (weirdly) happy
1 parent 1f94d55 commit a2c890f

File tree

85 files changed

+1647
-548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1647
-548
lines changed

tests/ui/borrow_deref_ref.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ mod false_negative {
6969
let x = &12;
7070
let addr_x = &x as *const _ as usize;
7171
let addr_y = &x as *const _ as usize; // assert ok
72-
//~^ borrow_deref_ref
72+
//
73+
//~^^ borrow_deref_ref
7374
// let addr_y = &x as *const _ as usize; // assert fail
7475
assert_ne!(addr_x, addr_y);
7576
}

tests/ui/borrow_deref_ref.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ mod false_negative {
6969
let x = &12;
7070
let addr_x = &x as *const _ as usize;
7171
let addr_y = &&*x as *const _ as usize; // assert ok
72-
//~^ borrow_deref_ref
72+
//
73+
//~^^ borrow_deref_ref
7374
// let addr_y = &x as *const _ as usize; // assert fail
7475
assert_ne!(addr_x, addr_y);
7576
}

tests/ui/cast.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,11 +532,14 @@ fn issue11738() {
532532
macro_rules! m {
533533
() => {
534534
let _ = i32::MIN as u32; // cast_sign_loss
535-
//~^ cast_sign_loss
535+
//
536+
//~^^ cast_sign_loss
536537
let _ = u32::MAX as u8; // cast_possible_truncation
537-
//~^ cast_possible_truncation
538+
//
539+
//~^^ cast_possible_truncation
538540
let _ = std::f64::consts::PI as f32; // cast_possible_truncation
539-
//~^ cast_possible_truncation
541+
//
542+
//~^^ cast_possible_truncation
540543
let _ = 0i8 as i32; // cast_lossless
541544
};
542545
}

tests/ui/cast.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ LL | m!();
662662
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
663663

664664
error: casting `u32` to `u8` may truncate the value
665-
--> tests/ui/cast.rs:536:21
665+
--> tests/ui/cast.rs:537:21
666666
|
667667
LL | let _ = u32::MAX as u8; // cast_possible_truncation
668668
| ^^^^^^^^^^^^^^
@@ -678,7 +678,7 @@ LL | let _ = u8::try_from(u32::MAX); // cast_possible_truncation
678678
| ~~~~~~~~~~~~~~~~~~~~~~
679679

680680
error: casting `f64` to `f32` may truncate the value
681-
--> tests/ui/cast.rs:538:21
681+
--> tests/ui/cast.rs:540:21
682682
|
683683
LL | let _ = std::f64::consts::PI as f32; // cast_possible_truncation
684684
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -690,7 +690,7 @@ LL | m!();
690690
= note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
691691

692692
error: casting `i64` to `usize` may truncate the value on targets with 32-bit wide pointers
693-
--> tests/ui/cast.rs:548:5
693+
--> tests/ui/cast.rs:551:5
694694
|
695695
LL | bar.unwrap().unwrap() as usize
696696
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -702,13 +702,13 @@ LL | usize::try_from(bar.unwrap().unwrap())
702702
|
703703

704704
error: casting `i64` to `usize` may lose the sign of the value
705-
--> tests/ui/cast.rs:548:5
705+
--> tests/ui/cast.rs:551:5
706706
|
707707
LL | bar.unwrap().unwrap() as usize
708708
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
709709

710710
error: casting `u64` to `u8` may truncate the value
711-
--> tests/ui/cast.rs:565:5
711+
--> tests/ui/cast.rs:568:5
712712
|
713713
LL | (256 & 999999u64) as u8;
714714
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -720,7 +720,7 @@ LL | u8::try_from(256 & 999999u64);
720720
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
721721

722722
error: casting `u64` to `u8` may truncate the value
723-
--> tests/ui/cast.rs:568:5
723+
--> tests/ui/cast.rs:571:5
724724
|
725725
LL | (255 % 999999u64) as u8;
726726
| ^^^^^^^^^^^^^^^^^^^^^^^

tests/ui/clone_on_copy.fixed

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fn clone_on_copy() -> Option<(i32)> {
8181
// Issue #9277
8282
let opt: &Option<i32> = &None;
8383
let value = (*opt)?; // operator precedence needed (*opt)?
84-
//~^ clone_on_copy
84+
//
85+
//~^^ clone_on_copy
8586
None
8687
}

tests/ui/clone_on_copy.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ fn clone_on_copy() -> Option<(i32)> {
8181
// Issue #9277
8282
let opt: &Option<i32> = &None;
8383
let value = opt.clone()?; // operator precedence needed (*opt)?
84-
//~^ clone_on_copy
84+
//
85+
//~^^ clone_on_copy
8586
None
8687
}

tests/ui/cloned_instead_of_copied.fixed

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ fn msrv_1_34() {
3030
fn msrv_1_35() {
3131
let _ = [1].iter().cloned();
3232
let _ = Some(&1).copied(); // Option::copied needs 1.35
33-
//~^ cloned_instead_of_copied
33+
//
34+
//~^^ cloned_instead_of_copied
3435
}
3536

3637
#[clippy::msrv = "1.36"]
3738
fn msrv_1_36() {
3839
let _ = [1].iter().copied(); // Iterator::copied needs 1.36
39-
//~^ cloned_instead_of_copied
40+
//
41+
//~^^ cloned_instead_of_copied
4042
let _ = Some(&1).copied();
4143
//~^ cloned_instead_of_copied
4244
}

tests/ui/cloned_instead_of_copied.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,15 @@ fn msrv_1_34() {
3030
fn msrv_1_35() {
3131
let _ = [1].iter().cloned();
3232
let _ = Some(&1).cloned(); // Option::copied needs 1.35
33-
//~^ cloned_instead_of_copied
33+
//
34+
//~^^ cloned_instead_of_copied
3435
}
3536

3637
#[clippy::msrv = "1.36"]
3738
fn msrv_1_36() {
3839
let _ = [1].iter().cloned(); // Iterator::copied needs 1.36
39-
//~^ cloned_instead_of_copied
40+
//
41+
//~^^ cloned_instead_of_copied
4042
let _ = Some(&1).cloned();
4143
//~^ cloned_instead_of_copied
4244
}

tests/ui/cloned_instead_of_copied.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ LL | let _ = Some(&1).cloned(); // Option::copied needs 1.35
3838
| ^^^^^^ help: try: `copied`
3939

4040
error: used `cloned` where `copied` could be used instead
41-
--> tests/ui/cloned_instead_of_copied.rs:38:24
41+
--> tests/ui/cloned_instead_of_copied.rs:39:24
4242
|
4343
LL | let _ = [1].iter().cloned(); // Iterator::copied needs 1.36
4444
| ^^^^^^ help: try: `copied`
4545

4646
error: used `cloned` where `copied` could be used instead
47-
--> tests/ui/cloned_instead_of_copied.rs:40:22
47+
--> tests/ui/cloned_instead_of_copied.rs:42:22
4848
|
4949
LL | let _ = Some(&1).cloned();
5050
| ^^^^^^ help: try: `copied`

tests/ui/collapsible_else_if.stderr

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
error: this `else { if .. }` block can be collapsed
2+
--> tests/ui/collapsible_else_if.rs:11:12
3+
|
4+
LL | } else {
5+
| ____________^
6+
LL | | if y == "world" {
7+
LL | | println!("world!")
8+
LL | | }
9+
LL | | }
10+
| |_____^
11+
|
12+
= note: `-D clippy::collapsible-else-if` implied by `-D warnings`
13+
= help: to override `-D warnings` add `#[allow(clippy::collapsible_else_if)]`
14+
help: collapse nested if block
15+
|
16+
LL ~ } else if y == "world" {
17+
LL + println!("world!")
18+
LL + }
19+
|
20+
21+
error: this `else { if .. }` block can be collapsed
22+
--> tests/ui/collapsible_else_if.rs:20:12
23+
|
24+
LL | } else {
25+
| ____________^
26+
LL | | if let Some(42) = Some(42) {
27+
LL | | println!("world!")
28+
LL | | }
29+
LL | | }
30+
| |_____^
31+
|
32+
help: collapse nested if block
33+
|
34+
LL ~ } else if let Some(42) = Some(42) {
35+
LL + println!("world!")
36+
LL + }
37+
|
38+
39+
error: this `else { if .. }` block can be collapsed
40+
--> tests/ui/collapsible_else_if.rs:29:12
41+
|
42+
LL | } else {
43+
| ____________^
44+
LL | | if y == "world" {
45+
LL | | println!("world")
46+
... |
47+
LL | | }
48+
| |_____^
49+
|
50+
help: collapse nested if block
51+
|
52+
LL ~ } else if y == "world" {
53+
LL + println!("world")
54+
LL + }
55+
LL + else {
56+
LL + println!("!")
57+
LL + }
58+
|
59+
60+
error: this `else { if .. }` block can be collapsed
61+
--> tests/ui/collapsible_else_if.rs:41:12
62+
|
63+
LL | } else {
64+
| ____________^
65+
LL | | if let Some(42) = Some(42) {
66+
LL | | println!("world")
67+
... |
68+
LL | | }
69+
| |_____^
70+
|
71+
help: collapse nested if block
72+
|
73+
LL ~ } else if let Some(42) = Some(42) {
74+
LL + println!("world")
75+
LL + }
76+
LL + else {
77+
LL + println!("!")
78+
LL + }
79+
|
80+
81+
error: this `else { if .. }` block can be collapsed
82+
--> tests/ui/collapsible_else_if.rs:53:12
83+
|
84+
LL | } else {
85+
| ____________^
86+
LL | | if let Some(42) = Some(42) {
87+
LL | | println!("world")
88+
... |
89+
LL | | }
90+
| |_____^
91+
|
92+
help: collapse nested if block
93+
|
94+
LL ~ } else if let Some(42) = Some(42) {
95+
LL + println!("world")
96+
LL + }
97+
LL + else {
98+
LL + println!("!")
99+
LL + }
100+
|
101+
102+
error: this `else { if .. }` block can be collapsed
103+
--> tests/ui/collapsible_else_if.rs:65:12
104+
|
105+
LL | } else {
106+
| ____________^
107+
LL | | if x == "hello" {
108+
LL | | println!("world")
109+
... |
110+
LL | | }
111+
| |_____^
112+
|
113+
help: collapse nested if block
114+
|
115+
LL ~ } else if x == "hello" {
116+
LL + println!("world")
117+
LL + }
118+
LL + else {
119+
LL + println!("!")
120+
LL + }
121+
|
122+
123+
error: this `else { if .. }` block can be collapsed
124+
--> tests/ui/collapsible_else_if.rs:77:12
125+
|
126+
LL | } else {
127+
| ____________^
128+
LL | | if let Some(42) = Some(42) {
129+
LL | | println!("world")
130+
... |
131+
LL | | }
132+
| |_____^
133+
|
134+
help: collapse nested if block
135+
|
136+
LL ~ } else if let Some(42) = Some(42) {
137+
LL + println!("world")
138+
LL + }
139+
LL + else {
140+
LL + println!("!")
141+
LL + }
142+
|
143+
144+
error: this `else { if .. }` block can be collapsed
145+
--> tests/ui/collapsible_else_if.rs:100:10
146+
|
147+
LL | }else{
148+
| __________^
149+
LL | | if false {}
150+
LL | | }
151+
| |_____^ help: collapse nested if block: `if false {}`
152+
153+
error: aborting due to 8 previous errors
154+

0 commit comments

Comments
 (0)