You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2025. It is now read-only.
"used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`",
87
+
move |diag| {
88
+
diag.help(
89
+
"`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",
90
+
);
91
+
diag.span_note(panics.result,"return Err() instead of panicking");
= note: `-D clippy::panic-in-result` implied by `-D warnings`
11
-
= help: unimplemented, unreachable, todo or panic should not be used in a function that returns result
12
-
note: will cause the application to crash.
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
13
--> $DIR/panic_in_result.rs:8:9
14
14
|
15
15
LL | panic!("error");
16
16
| ^^^^^^^^^^^^^^^^
17
17
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
18
18
19
-
error: used unimplemented, unreachable, todo or panic in a function that returns result
19
+
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
= help: unimplemented, unreachable, todo or panic should not be used in a function that returns result
29
-
note: will cause the application to crash.
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
30
--> $DIR/panic_in_result.rs:13:9
31
31
|
32
32
LL | unimplemented!();
33
33
| ^^^^^^^^^^^^^^^^^
34
34
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
35
35
36
-
error: used unimplemented, unreachable, todo or panic in a function that returns result
36
+
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
= help: unimplemented, unreachable, todo or panic should not be used in a function that returns result
46
-
note: will cause the application to crash.
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
47
--> $DIR/panic_in_result.rs:18:9
48
48
|
49
49
LL | unreachable!();
50
50
| ^^^^^^^^^^^^^^^
51
51
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
52
52
53
-
error: used unimplemented, unreachable, todo or panic in a function that returns result
53
+
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
= help: unimplemented, unreachable, todo or panic should not be used in a function that returns result
63
-
note: will cause the application to crash.
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
64
--> $DIR/panic_in_result.rs:23:9
65
65
|
66
66
LL | todo!("Finish this");
67
67
| ^^^^^^^^^^^^^^^^^^^^^
68
68
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
69
69
70
-
error: aborting due to 4 previous errors
70
+
error: used `unimplemented!()`, `unreachable!()`, `todo!()` or `panic!()` in a function that returns `Result`
= 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.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.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.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)
0 commit comments