|
| 1 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 2 | + --> $DIR/panic_in_result_fn.rs:6:5 |
| 3 | + | |
| 4 | +LL | / fn result_with_panic() -> Result<bool, String> // should emit lint |
| 5 | +LL | | { |
| 6 | +LL | | panic!("error"); |
| 7 | +LL | | } |
| 8 | + | |_____^ |
| 9 | + | |
| 10 | + = note: `-D clippy::panic-in-result-fn` implied by `-D warnings` |
| 11 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 12 | +note: return Err() instead of panicking |
| 13 | + --> $DIR/panic_in_result_fn.rs:8:9 |
| 14 | + | |
| 15 | +LL | panic!("error"); |
| 16 | + | ^^^^^^^^^^^^^^^^ |
| 17 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 18 | + |
| 19 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 20 | + --> $DIR/panic_in_result_fn.rs:11:5 |
| 21 | + | |
| 22 | +LL | / fn result_with_unimplemented() -> Result<bool, String> // should emit lint |
| 23 | +LL | | { |
| 24 | +LL | | unimplemented!(); |
| 25 | +LL | | } |
| 26 | + | |_____^ |
| 27 | + | |
| 28 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 29 | +note: return Err() instead of panicking |
| 30 | + --> $DIR/panic_in_result_fn.rs:13:9 |
| 31 | + | |
| 32 | +LL | unimplemented!(); |
| 33 | + | ^^^^^^^^^^^^^^^^^ |
| 34 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 35 | + |
| 36 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 37 | + --> $DIR/panic_in_result_fn.rs:16:5 |
| 38 | + | |
| 39 | +LL | / fn result_with_unreachable() -> Result<bool, String> // should emit lint |
| 40 | +LL | | { |
| 41 | +LL | | unreachable!(); |
| 42 | +LL | | } |
| 43 | + | |_____^ |
| 44 | + | |
| 45 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 46 | +note: return Err() instead of panicking |
| 47 | + --> $DIR/panic_in_result_fn.rs:18:9 |
| 48 | + | |
| 49 | +LL | unreachable!(); |
| 50 | + | ^^^^^^^^^^^^^^^ |
| 51 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 52 | + |
| 53 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 54 | + --> $DIR/panic_in_result_fn.rs:21:5 |
| 55 | + | |
| 56 | +LL | / fn result_with_todo() -> Result<bool, String> // should emit lint |
| 57 | +LL | | { |
| 58 | +LL | | todo!("Finish this"); |
| 59 | +LL | | } |
| 60 | + | |_____^ |
| 61 | + | |
| 62 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 63 | +note: return Err() instead of panicking |
| 64 | + --> $DIR/panic_in_result_fn.rs:23:9 |
| 65 | + | |
| 66 | +LL | todo!("Finish this"); |
| 67 | + | ^^^^^^^^^^^^^^^^^^^^^ |
| 68 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 69 | + |
| 70 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 71 | + --> $DIR/panic_in_result_fn.rs:52:1 |
| 72 | + | |
| 73 | +LL | / fn function_result_with_panic() -> Result<bool, String> // should emit lint |
| 74 | +LL | | { |
| 75 | +LL | | panic!("error"); |
| 76 | +LL | | } |
| 77 | + | |_^ |
| 78 | + | |
| 79 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 80 | +note: return Err() instead of panicking |
| 81 | + --> $DIR/panic_in_result_fn.rs:54:5 |
| 82 | + | |
| 83 | +LL | panic!("error"); |
| 84 | + | ^^^^^^^^^^^^^^^^ |
| 85 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 86 | + |
| 87 | +error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result` |
| 88 | + --> $DIR/panic_in_result_fn.rs:67:1 |
| 89 | + | |
| 90 | +LL | / fn main() -> Result<(), String> { |
| 91 | +LL | | todo!("finish main method"); |
| 92 | +LL | | Ok(()) |
| 93 | +LL | | } |
| 94 | + | |_^ |
| 95 | + | |
| 96 | + = help: `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing |
| 97 | +note: return Err() instead of panicking |
| 98 | + --> $DIR/panic_in_result_fn.rs:68:5 |
| 99 | + | |
| 100 | +LL | todo!("finish main method"); |
| 101 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 102 | + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) |
| 103 | + |
| 104 | +error: aborting due to 6 previous errors |
| 105 | + |
0 commit comments