mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-23 21:23:56 +00:00
95 lines
2.8 KiB
Text
95 lines
2.8 KiB
Text
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:30:5
|
|
|
|
|
LL | / if !a.is_empty() {
|
|
LL | | panic!("qaqaq{:?}", a);
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);`
|
|
|
|
|
= note: `-D clippy::manual-assert` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:33:5
|
|
|
|
|
LL | / if !a.is_empty() {
|
|
LL | | panic!("qwqwq");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(a.is_empty(), "qwqwq");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:50:5
|
|
|
|
|
LL | / if b.is_empty() {
|
|
LL | | panic!("panic1");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!b.is_empty(), "panic1");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:53:5
|
|
|
|
|
LL | / if b.is_empty() && a.is_empty() {
|
|
LL | | panic!("panic2");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!(b.is_empty() && a.is_empty()), "panic2");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:56:5
|
|
|
|
|
LL | / if a.is_empty() && !b.is_empty() {
|
|
LL | | panic!("panic3");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:59:5
|
|
|
|
|
LL | / if b.is_empty() || a.is_empty() {
|
|
LL | | panic!("panic4");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!(b.is_empty() || a.is_empty()), "panic4");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:62:5
|
|
|
|
|
LL | / if a.is_empty() || !b.is_empty() {
|
|
LL | | panic!("panic5");
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:65:5
|
|
|
|
|
LL | / if a.is_empty() {
|
|
LL | | panic!("with expansion {}", one!())
|
|
LL | | }
|
|
| |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());`
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:77:5
|
|
|
|
|
LL | / if a > 2 {
|
|
LL | | // comment
|
|
LL | | /* this is a
|
|
LL | | multiline
|
|
... |
|
|
LL | | panic!("panic with comment") // comment after `panic!`
|
|
LL | | }
|
|
| |_____^
|
|
|
|
|
help: try instead
|
|
|
|
|
LL | assert!(!(a > 2), "panic with comment");
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
|
--> tests/ui/manual_assert.rs:91:25
|
|
|
|
|
LL | const BAR: () = if N == 0 {
|
|
| _________________________^
|
|
LL | | panic!()
|
|
LL | | };
|
|
| |_________^ help: try instead: `assert!(!(N == 0), )`
|
|
|
|
error: aborting due to 10 previous errors
|
|
|