Skip to content

Commit 3ab02aa

Browse files
committed
fix tests
1 parent 22be60b commit 3ab02aa

5 files changed

+31
-34
lines changed

tests/ui/manual_assert.edition2018.fixed

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// run-rustfix
55

66
#![warn(clippy::manual_assert)]
7-
#![allow(clippy::nonminimal_bool)]
8-
#![allow(dead_code)]
7+
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
98

109
macro_rules! one {
1110
() => {
@@ -52,13 +51,13 @@ fn main() {
5251
assert!(!a.is_empty(), "with expansion {}", one!());
5352
}
5453

55-
fn issue7730() {
54+
fn issue7730(a: u8) {
5655
// Suggestion should preserve comment
5756
// comment
5857
/* this is a
5958
multiline
6059
comment */
6160
/// Doc comment
6261
// comment after `panic!`
63-
assert!(!true, "panic with comment");
62+
assert!(!(a > 2), "panic with comment");
6463
}

tests/ui/manual_assert.edition2018.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: only a `panic!` in `if`-then statement
2-
--> $DIR/manual_assert.rs:31:5
2+
--> $DIR/manual_assert.rs:30:5
33
|
44
LL | / if !a.is_empty() {
55
LL | | panic!("qaqaq{:?}", a);
@@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
1313
|
1414

1515
error: only a `panic!` in `if`-then statement
16-
--> $DIR/manual_assert.rs:34:5
16+
--> $DIR/manual_assert.rs:33:5
1717
|
1818
LL | / if !a.is_empty() {
1919
LL | | panic!("qwqwq");
@@ -26,7 +26,7 @@ LL | assert!(a.is_empty(), "qwqwq");
2626
|
2727

2828
error: only a `panic!` in `if`-then statement
29-
--> $DIR/manual_assert.rs:51:5
29+
--> $DIR/manual_assert.rs:50:5
3030
|
3131
LL | / if b.is_empty() {
3232
LL | | panic!("panic1");
@@ -39,7 +39,7 @@ LL | assert!(!b.is_empty(), "panic1");
3939
|
4040

4141
error: only a `panic!` in `if`-then statement
42-
--> $DIR/manual_assert.rs:54:5
42+
--> $DIR/manual_assert.rs:53:5
4343
|
4444
LL | / if b.is_empty() && a.is_empty() {
4545
LL | | panic!("panic2");
@@ -52,7 +52,7 @@ LL | assert!(!(b.is_empty() && a.is_empty()), "panic2");
5252
|
5353

5454
error: only a `panic!` in `if`-then statement
55-
--> $DIR/manual_assert.rs:57:5
55+
--> $DIR/manual_assert.rs:56:5
5656
|
5757
LL | / if a.is_empty() && !b.is_empty() {
5858
LL | | panic!("panic3");
@@ -65,7 +65,7 @@ LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3");
6565
|
6666

6767
error: only a `panic!` in `if`-then statement
68-
--> $DIR/manual_assert.rs:60:5
68+
--> $DIR/manual_assert.rs:59:5
6969
|
7070
LL | / if b.is_empty() || a.is_empty() {
7171
LL | | panic!("panic4");
@@ -78,7 +78,7 @@ LL | assert!(!(b.is_empty() || a.is_empty()), "panic4");
7878
|
7979

8080
error: only a `panic!` in `if`-then statement
81-
--> $DIR/manual_assert.rs:63:5
81+
--> $DIR/manual_assert.rs:62:5
8282
|
8383
LL | / if a.is_empty() || !b.is_empty() {
8484
LL | | panic!("panic5");
@@ -91,7 +91,7 @@ LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5");
9191
|
9292

9393
error: only a `panic!` in `if`-then statement
94-
--> $DIR/manual_assert.rs:66:5
94+
--> $DIR/manual_assert.rs:65:5
9595
|
9696
LL | / if a.is_empty() {
9797
LL | | panic!("with expansion {}", one!())
@@ -104,9 +104,9 @@ LL | assert!(!a.is_empty(), "with expansion {}", one!());
104104
|
105105

106106
error: only a `panic!` in `if`-then statement
107-
--> $DIR/manual_assert.rs:73:5
107+
--> $DIR/manual_assert.rs:72:5
108108
|
109-
LL | / if true {
109+
LL | / if a > 2 {
110110
LL | | // comment
111111
LL | | /* this is a
112112
LL | | multiline
@@ -117,7 +117,7 @@ LL | | }
117117
|
118118
help: try instead
119119
|
120-
LL | assert!(!true, "panic with comment");
120+
LL | assert!(!(a > 2), "panic with comment");
121121
|
122122

123123
error: aborting due to 9 previous errors

tests/ui/manual_assert.edition2021.fixed

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// run-rustfix
55

66
#![warn(clippy::manual_assert)]
7-
#![allow(clippy::nonminimal_bool)]
8-
#![allow(dead_code)]
7+
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
98

109
macro_rules! one {
1110
() => {
@@ -52,13 +51,13 @@ fn main() {
5251
assert!(!a.is_empty(), "with expansion {}", one!());
5352
}
5453

55-
fn issue7730() {
54+
fn issue7730(a: u8) {
5655
// Suggestion should preserve comment
5756
// comment
5857
/* this is a
5958
multiline
6059
comment */
6160
/// Doc comment
6261
// comment after `panic!`
63-
assert!(!true, "panic with comment");
62+
assert!(!(a > 2), "panic with comment");
6463
}

tests/ui/manual_assert.edition2021.stderr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: only a `panic!` in `if`-then statement
2-
--> $DIR/manual_assert.rs:31:5
2+
--> $DIR/manual_assert.rs:30:5
33
|
44
LL | / if !a.is_empty() {
55
LL | | panic!("qaqaq{:?}", a);
@@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
1313
|
1414

1515
error: only a `panic!` in `if`-then statement
16-
--> $DIR/manual_assert.rs:34:5
16+
--> $DIR/manual_assert.rs:33:5
1717
|
1818
LL | / if !a.is_empty() {
1919
LL | | panic!("qwqwq");
@@ -26,7 +26,7 @@ LL | assert!(a.is_empty(), "qwqwq");
2626
|
2727

2828
error: only a `panic!` in `if`-then statement
29-
--> $DIR/manual_assert.rs:51:5
29+
--> $DIR/manual_assert.rs:50:5
3030
|
3131
LL | / if b.is_empty() {
3232
LL | | panic!("panic1");
@@ -39,7 +39,7 @@ LL | assert!(!b.is_empty(), "panic1");
3939
|
4040

4141
error: only a `panic!` in `if`-then statement
42-
--> $DIR/manual_assert.rs:54:5
42+
--> $DIR/manual_assert.rs:53:5
4343
|
4444
LL | / if b.is_empty() && a.is_empty() {
4545
LL | | panic!("panic2");
@@ -52,7 +52,7 @@ LL | assert!(!(b.is_empty() && a.is_empty()), "panic2");
5252
|
5353

5454
error: only a `panic!` in `if`-then statement
55-
--> $DIR/manual_assert.rs:57:5
55+
--> $DIR/manual_assert.rs:56:5
5656
|
5757
LL | / if a.is_empty() && !b.is_empty() {
5858
LL | | panic!("panic3");
@@ -65,7 +65,7 @@ LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3");
6565
|
6666

6767
error: only a `panic!` in `if`-then statement
68-
--> $DIR/manual_assert.rs:60:5
68+
--> $DIR/manual_assert.rs:59:5
6969
|
7070
LL | / if b.is_empty() || a.is_empty() {
7171
LL | | panic!("panic4");
@@ -78,7 +78,7 @@ LL | assert!(!(b.is_empty() || a.is_empty()), "panic4");
7878
|
7979

8080
error: only a `panic!` in `if`-then statement
81-
--> $DIR/manual_assert.rs:63:5
81+
--> $DIR/manual_assert.rs:62:5
8282
|
8383
LL | / if a.is_empty() || !b.is_empty() {
8484
LL | | panic!("panic5");
@@ -91,7 +91,7 @@ LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5");
9191
|
9292

9393
error: only a `panic!` in `if`-then statement
94-
--> $DIR/manual_assert.rs:66:5
94+
--> $DIR/manual_assert.rs:65:5
9595
|
9696
LL | / if a.is_empty() {
9797
LL | | panic!("with expansion {}", one!())
@@ -104,9 +104,9 @@ LL | assert!(!a.is_empty(), "with expansion {}", one!());
104104
|
105105

106106
error: only a `panic!` in `if`-then statement
107-
--> $DIR/manual_assert.rs:73:5
107+
--> $DIR/manual_assert.rs:72:5
108108
|
109-
LL | / if true {
109+
LL | / if a > 2 {
110110
LL | | // comment
111111
LL | | /* this is a
112112
LL | | multiline
@@ -117,7 +117,7 @@ LL | | }
117117
|
118118
help: try instead
119119
|
120-
LL | assert!(!true, "panic with comment");
120+
LL | assert!(!(a > 2), "panic with comment");
121121
|
122122

123123
error: aborting due to 9 previous errors

tests/ui/manual_assert.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
// run-rustfix
55

66
#![warn(clippy::manual_assert)]
7-
#![allow(clippy::nonminimal_bool)]
8-
#![allow(dead_code)]
7+
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]
98

109
macro_rules! one {
1110
() => {
@@ -68,9 +67,9 @@ fn main() {
6867
}
6968
}
7069

71-
fn issue7730() {
70+
fn issue7730(a: u8) {
7271
// Suggestion should preserve comment
73-
if true {
72+
if a > 2 {
7473
// comment
7574
/* this is a
7675
multiline

0 commit comments

Comments
 (0)