2021-09-28 12:03:12 -05:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:32:5
|
2021-09-28 12:03:12 -05:00
|
|
|
|
|
|
|
|
LL | / if !a.is_empty() {
|
|
|
|
LL | | panic!("qaqaq{:?}", a);
|
|
|
|
LL | | }
|
2022-10-11 11:17:59 -05:00
|
|
|
| |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);`
|
2021-09-28 12:03:12 -05:00
|
|
|
|
|
2021-11-04 07:52:36 -05:00
|
|
|
= note: `-D clippy::manual-assert` implied by `-D warnings`
|
2023-08-01 07:02:21 -05:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
|
2021-09-28 12:03:12 -05:00
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:35:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:52:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:55:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:58:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:61:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:64:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
LL | / if a.is_empty() || !b.is_empty() {
|
|
|
|
LL | | panic!("panic5");
|
|
|
|
LL | | }
|
|
|
|
| |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");`
|
|
|
|
|
2022-02-10 11:40:06 -06:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:67:5
|
2022-02-10 11:40:06 -06:00
|
|
|
|
|
|
|
|
LL | / if a.is_empty() {
|
|
|
|
LL | | panic!("with expansion {}", one!())
|
|
|
|
LL | | }
|
2022-10-11 11:17:59 -05:00
|
|
|
| |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());`
|
2022-10-06 02:44:38 -05:00
|
|
|
|
2023-02-10 07:01:19 -06:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:79:5
|
2023-02-10 07:01:19 -06:00
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
2024-03-22 19:32:25 -05:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-15 03:44:02 -05:00
|
|
|
--> tests/ui/manual_assert.rs:93:25
|
2024-03-22 19:32:25 -05:00
|
|
|
|
|
|
|
|
LL | const BAR: () = if N == 0 {
|
|
|
|
| _________________________^
|
|
|
|
LL | | panic!()
|
|
|
|
LL | | };
|
|
|
|
| |_________^ help: try instead: `assert!(!(N == 0), )`
|
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
2021-09-28 12:03:12 -05:00
|
|
|
|