diff --git a/tests/ui/manual_assert.edition2018.fixed b/tests/ui/manual_assert.edition2018.fixed index 81e38e1bf795..84f6855f3387 100644 --- a/tests/ui/manual_assert.edition2018.fixed +++ b/tests/ui/manual_assert.edition2018.fixed @@ -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"); } diff --git a/tests/ui/manual_assert.edition2018.stderr b/tests/ui/manual_assert.edition2018.stderr index e71bf428382c..dbd21be2da9e 100644 --- a/tests/ui/manual_assert.edition2018.stderr +++ b/tests/ui/manual_assert.edition2018.stderr @@ -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 diff --git a/tests/ui/manual_assert.edition2021.fixed b/tests/ui/manual_assert.edition2021.fixed index 81e38e1bf795..84f6855f3387 100644 --- a/tests/ui/manual_assert.edition2021.fixed +++ b/tests/ui/manual_assert.edition2021.fixed @@ -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"); } diff --git a/tests/ui/manual_assert.edition2021.stderr b/tests/ui/manual_assert.edition2021.stderr index e71bf428382c..dbd21be2da9e 100644 --- a/tests/ui/manual_assert.edition2021.stderr +++ b/tests/ui/manual_assert.edition2021.stderr @@ -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 diff --git a/tests/ui/manual_assert.rs b/tests/ui/manual_assert.rs index e9dd81a758a8..14abf94965af 100644 --- a/tests/ui/manual_assert.rs +++ b/tests/ui/manual_assert.rs @@ -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