fix tests

This commit is contained in:
kraktus 2022-10-02 15:25:50 +02:00
parent 22be60b4f0
commit 3ab02aa359
5 changed files with 31 additions and 34 deletions

View File

@ -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 {
() => {
@ -52,7 +51,7 @@ fn main() {
assert!(!a.is_empty(), "with expansion {}", one!());
}
fn issue7730() {
fn issue7730(a: u8) {
// Suggestion should preserve comment
// comment
/* this is a
@ -60,5 +59,5 @@ fn issue7730() {
comment */
/// Doc comment
// comment after `panic!`
assert!(!true, "panic with comment");
assert!(!(a > 2), "panic with comment");
}

View File

@ -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);
@ -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");
@ -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");
@ -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");
@ -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");
@ -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");
@ -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");
@ -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!())
@ -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
@ -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

View File

@ -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 {
() => {
@ -52,7 +51,7 @@ fn main() {
assert!(!a.is_empty(), "with expansion {}", one!());
}
fn issue7730() {
fn issue7730(a: u8) {
// Suggestion should preserve comment
// comment
/* this is a
@ -60,5 +59,5 @@ fn issue7730() {
comment */
/// Doc comment
// comment after `panic!`
assert!(!true, "panic with comment");
assert!(!(a > 2), "panic with comment");
}

View File

@ -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);
@ -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");
@ -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");
@ -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");
@ -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");
@ -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");
@ -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");
@ -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!())
@ -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
@ -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

View File

@ -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 {
() => {
@ -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