|
| 1 | +warning: only a `panic!` in `if`-then statement |
| 2 | + --> $DIR/manual_assert.rs:31:5 |
| 3 | + | |
| 4 | +LL | / if !a.is_empty() { |
| 5 | +LL | | panic!("qaqaq{:?}", a); |
| 6 | +LL | | } |
| 7 | + | |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);` |
| 8 | + | |
| 9 | +note: the lint level is defined here |
| 10 | + --> $DIR/manual_assert.rs:6:9 |
| 11 | + | |
| 12 | +LL | #![warn(clippy::manual_assert)] |
| 13 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 14 | + |
| 15 | +warning: only a `panic!` in `if`-then statement |
| 16 | + --> $DIR/manual_assert.rs:34:5 |
| 17 | + | |
| 18 | +LL | / if !a.is_empty() { |
| 19 | +LL | | panic!("qwqwq"); |
| 20 | +LL | | } |
| 21 | + | |_____^ help: try instead: `assert!(a.is_empty(), "qwqwq");` |
| 22 | + |
| 23 | +warning: only a `panic!` in `if`-then statement |
| 24 | + --> $DIR/manual_assert.rs:51:5 |
| 25 | + | |
| 26 | +LL | / if b.is_empty() { |
| 27 | +LL | | panic!("panic1"); |
| 28 | +LL | | } |
| 29 | + | |_____^ help: try instead: `assert!(!b.is_empty(), "panic1");` |
| 30 | + |
| 31 | +warning: only a `panic!` in `if`-then statement |
| 32 | + --> $DIR/manual_assert.rs:54:5 |
| 33 | + | |
| 34 | +LL | / if b.is_empty() && a.is_empty() { |
| 35 | +LL | | panic!("panic2"); |
| 36 | +LL | | } |
| 37 | + | |_____^ help: try instead: `assert!(!(b.is_empty() && a.is_empty()), "panic2");` |
| 38 | + |
| 39 | +warning: only a `panic!` in `if`-then statement |
| 40 | + --> $DIR/manual_assert.rs:57:5 |
| 41 | + | |
| 42 | +LL | / if a.is_empty() && !b.is_empty() { |
| 43 | +LL | | panic!("panic3"); |
| 44 | +LL | | } |
| 45 | + | |_____^ help: try instead: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");` |
| 46 | + |
| 47 | +warning: only a `panic!` in `if`-then statement |
| 48 | + --> $DIR/manual_assert.rs:60:5 |
| 49 | + | |
| 50 | +LL | / if b.is_empty() || a.is_empty() { |
| 51 | +LL | | panic!("panic4"); |
| 52 | +LL | | } |
| 53 | + | |_____^ help: try instead: `assert!(!(b.is_empty() || a.is_empty()), "panic4");` |
| 54 | + |
| 55 | +warning: only a `panic!` in `if`-then statement |
| 56 | + --> $DIR/manual_assert.rs:63:5 |
| 57 | + | |
| 58 | +LL | / if a.is_empty() || !b.is_empty() { |
| 59 | +LL | | panic!("panic5"); |
| 60 | +LL | | } |
| 61 | + | |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");` |
| 62 | + |
| 63 | +warning: only a `panic!` in `if`-then statement |
| 64 | + --> $DIR/manual_assert.rs:66:5 |
| 65 | + | |
| 66 | +LL | / if a.is_empty() { |
| 67 | +LL | | panic!("with expansion {}", one!()) |
| 68 | +LL | | } |
| 69 | + | |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());` |
| 70 | + |
| 71 | +warning: only a `panic!` in `if`-then statement |
| 72 | + --> $DIR/manual_assert.rs:78:5 |
| 73 | + | |
| 74 | +LL | / if a > 2 { |
| 75 | +LL | | // comment |
| 76 | +LL | | /* this is a |
| 77 | +LL | | multiline |
| 78 | +... | |
| 79 | +LL | | panic!("panic with comment") // comment after `panic!` |
| 80 | +LL | | } |
| 81 | + | |_____^ |
| 82 | + | |
| 83 | +help: try instead |
| 84 | + | |
| 85 | +LL | assert!(!(a > 2), "panic with comment"); |
| 86 | + | |
| 87 | + |
| 88 | +warning: 9 warnings emitted |
| 89 | + |
0 commit comments