Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kraktus committed Oct 2, 2022
1 parent 22be60b commit 3ab02aa
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 34 deletions.
7 changes: 3 additions & 4 deletions tests/ui/manual_assert.edition2018.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// run-rustfix

#![warn(clippy::manual_assert)]
#![allow(clippy::nonminimal_bool)]
#![allow(dead_code)]
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]

macro_rules! one {
() => {
Expand Down Expand Up @@ -52,13 +51,13 @@ fn main() {
assert!(!a.is_empty(), "with expansion {}", one!());
}

fn issue7730() {
fn issue7730(a: u8) {
// Suggestion should preserve comment
// comment
/* this is a
multiline
comment */
/// Doc comment
// comment after `panic!`
assert!(!true, "panic with comment");
assert!(!(a > 2), "panic with comment");
}
22 changes: 11 additions & 11 deletions tests/ui/manual_assert.edition2018.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:31:5
--> $DIR/manual_assert.rs:30:5
|
LL | / if !a.is_empty() {
LL | | panic!("qaqaq{:?}", a);
Expand All @@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|

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

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

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

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

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

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

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

error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:73:5
--> $DIR/manual_assert.rs:72:5
|
LL | / if true {
LL | / if a > 2 {
LL | | // comment
LL | | /* this is a
LL | | multiline
Expand All @@ -117,7 +117,7 @@ LL | | }
|
help: try instead
|
LL | assert!(!true, "panic with comment");
LL | assert!(!(a > 2), "panic with comment");
|

error: aborting due to 9 previous errors
Expand Down
7 changes: 3 additions & 4 deletions tests/ui/manual_assert.edition2021.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// run-rustfix

#![warn(clippy::manual_assert)]
#![allow(clippy::nonminimal_bool)]
#![allow(dead_code)]
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]

macro_rules! one {
() => {
Expand Down Expand Up @@ -52,13 +51,13 @@ fn main() {
assert!(!a.is_empty(), "with expansion {}", one!());
}

fn issue7730() {
fn issue7730(a: u8) {
// Suggestion should preserve comment
// comment
/* this is a
multiline
comment */
/// Doc comment
// comment after `panic!`
assert!(!true, "panic with comment");
assert!(!(a > 2), "panic with comment");
}
22 changes: 11 additions & 11 deletions tests/ui/manual_assert.edition2021.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:31:5
--> $DIR/manual_assert.rs:30:5
|
LL | / if !a.is_empty() {
LL | | panic!("qaqaq{:?}", a);
Expand All @@ -13,7 +13,7 @@ LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|

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

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

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

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

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

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

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

error: only a `panic!` in `if`-then statement
--> $DIR/manual_assert.rs:73:5
--> $DIR/manual_assert.rs:72:5
|
LL | / if true {
LL | / if a > 2 {
LL | | // comment
LL | | /* this is a
LL | | multiline
Expand All @@ -117,7 +117,7 @@ LL | | }
|
help: try instead
|
LL | assert!(!true, "panic with comment");
LL | assert!(!(a > 2), "panic with comment");
|

error: aborting due to 9 previous errors
Expand Down
7 changes: 3 additions & 4 deletions tests/ui/manual_assert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
// run-rustfix

#![warn(clippy::manual_assert)]
#![allow(clippy::nonminimal_bool)]
#![allow(dead_code)]
#![allow(dead_code, unused_doc_comments, clippy::nonminimal_bool)]

macro_rules! one {
() => {
Expand Down Expand Up @@ -68,9 +67,9 @@ fn main() {
}
}

fn issue7730() {
fn issue7730(a: u8) {
// Suggestion should preserve comment
if true {
if a > 2 {
// comment
/* this is a
multiline
Expand Down

0 comments on commit 3ab02aa

Please sign in to comment.