2021-09-28 18:03:12 +01:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2024-07-25 18:29:17 +02:00
|
|
|
--> tests/ui/manual_assert.rs:32:5
|
2021-09-28 18:03:12 +01:00
|
|
|
|
|
|
|
|
|
LL | / if !a.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-09-28 18:03:12 +01:00
|
|
|
LL | | panic!("qaqaq{:?}", a);
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
2021-09-28 18:03:12 +01:00
|
|
|
|
|
2021-11-04 12:52:36 +00:00
|
|
|
= note: `-D clippy::manual-assert` implied by `-D warnings`
|
2023-08-01 14:02:21 +02:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::manual_assert)]`
|
2025-02-11 17:57:08 +01:00
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if !a.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("qaqaq{:?}", a);
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(a.is_empty(), "qaqaq{:?}", a);
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-09-28 18:03:12 +01:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:36:5
|
2021-09-28 18:03:12 +01:00
|
|
|
|
|
|
|
|
|
LL | / if !a.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-09-28 18:03:12 +01:00
|
|
|
LL | | panic!("qwqwq");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if !a.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("qwqwq");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(a.is_empty(), "qwqwq");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-09-28 18:03:12 +01:00
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:54:5
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
|
LL | / if b.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-10-07 11:21:30 +02:00
|
|
|
LL | | panic!("panic1");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if b.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("panic1");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!b.is_empty(), "panic1");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:58:5
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
|
LL | / if b.is_empty() && a.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-10-07 11:21:30 +02:00
|
|
|
LL | | panic!("panic2");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if b.is_empty() && a.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("panic2");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!(b.is_empty() && a.is_empty()), "panic2");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:62:5
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
|
LL | / if a.is_empty() && !b.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-10-07 11:21:30 +02:00
|
|
|
LL | | panic!("panic3");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if a.is_empty() && !b.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("panic3");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!(a.is_empty() && !b.is_empty()), "panic3");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:66:5
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
|
LL | / if b.is_empty() || a.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-10-07 11:21:30 +02:00
|
|
|
LL | | panic!("panic4");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if b.is_empty() || a.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("panic4");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!(b.is_empty() || a.is_empty()), "panic4");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:70:5
|
2021-10-07 11:21:30 +02:00
|
|
|
|
|
|
|
|
|
LL | / if a.is_empty() || !b.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2021-10-07 11:21:30 +02:00
|
|
|
LL | | panic!("panic5");
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if a.is_empty() || !b.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("panic5");
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!(a.is_empty() || !b.is_empty()), "panic5");
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2021-10-07 11:21:30 +02:00
|
|
|
|
2022-02-10 18:40:06 +01:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:74:5
|
2022-02-10 18:40:06 +01:00
|
|
|
|
|
|
|
|
|
LL | / if a.is_empty() {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2022-02-10 18:40:06 +01:00
|
|
|
LL | | panic!("with expansion {}", one!())
|
|
|
|
|
LL | | }
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - if a.is_empty() {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!("with expansion {}", one!())
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!a.is_empty(), "with expansion {}", one!());
|
2025-02-11 17:57:08 +01:00
|
|
|
|
|
2022-10-06 09:44:38 +02:00
|
|
|
|
|
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:87:5
|
2022-10-06 09:44:38 +02:00
|
|
|
|
|
|
|
|
|
LL | / if a > 2 {
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2022-10-06 09:44:38 +02:00
|
|
|
LL | | // comment
|
|
|
|
|
LL | | /* this is a
|
|
|
|
|
... |
|
|
|
|
|
LL | | panic!("panic with comment") // comment after `panic!`
|
|
|
|
|
LL | | }
|
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2024-07-09 22:30:26 +00:00
|
|
|
LL - if a > 2 {
|
2025-02-20 15:26:07 +01:00
|
|
|
LL -
|
2024-07-09 22:30:26 +00:00
|
|
|
LL - // comment
|
|
|
|
|
LL - /* this is a
|
|
|
|
|
LL - multiline
|
|
|
|
|
LL - comment */
|
|
|
|
|
LL - /// Doc comment
|
|
|
|
|
LL - panic!("panic with comment") // comment after `panic!`
|
|
|
|
|
LL - }
|
|
|
|
|
LL + assert!(!(a > 2), "panic with comment");
|
2022-10-06 09:44:38 +02:00
|
|
|
|
|
2022-02-10 18:40:06 +01:00
|
|
|
|
2024-04-04 19:52:55 +02:00
|
|
|
error: only a `panic!` in `if`-then statement
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/manual_assert.rs:102:25
|
2024-04-04 19:52:55 +02:00
|
|
|
|
|
|
|
|
|
LL | const BAR: () = if N == 0 {
|
|
|
|
|
| _________________________^
|
2025-02-11 17:57:08 +01:00
|
|
|
LL | |
|
2024-04-04 19:52:55 +02:00
|
|
|
LL | | panic!()
|
|
|
|
|
LL | | };
|
2025-02-11 17:57:08 +01:00
|
|
|
| |_________^
|
|
|
|
|
|
|
|
|
|
|
help: try instead
|
|
|
|
|
|
|
2025-02-20 15:26:07 +01:00
|
|
|
LL - const BAR: () = if N == 0 {
|
|
|
|
|
LL -
|
|
|
|
|
LL - panic!()
|
|
|
|
|
LL - };
|
|
|
|
|
LL + const BAR: () = assert!(!(N == 0), );
|
|
|
|
|
|
|
2024-04-04 19:52:55 +02:00
|
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
2021-09-28 18:03:12 +01:00
|
|
|
|