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
"used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`",
86
+
"used `panic!()` or assertion in a function that returns `Result`",
87
87
move |diag| {
88
88
diag.help(
89
-
"`unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing",
89
+
"`panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing",
90
90
);
91
91
diag.span_note(panics,"return Err() instead of panicking");
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
10
+
= help: `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
11
11
note: return Err() instead of panicking
12
12
--> $DIR/panic_in_result_fn.rs:8:9
13
13
|
14
14
LL | panic!("error");
15
15
| ^^^^^^^^^^^^^^^
16
16
= note: `-D clippy::panic-in-result-fn` implied by `-D warnings`
17
17
18
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
28
-
note: return Err() instead of panicking
29
-
--> $DIR/panic_in_result_fn.rs:13:9
30
-
|
31
-
LL | unimplemented!();
32
-
| ^^^^^^^^^^^^^^^^
33
-
34
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
44
-
note: return Err() instead of panicking
45
-
--> $DIR/panic_in_result_fn.rs:18:9
46
-
|
47
-
LL | unreachable!();
48
-
| ^^^^^^^^^^^^^^
49
-
50
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
60
-
note: return Err() instead of panicking
61
-
--> $DIR/panic_in_result_fn.rs:23:9
62
-
|
63
-
LL | todo!("Finish this");
64
-
| ^^^^^^^^^^^^^^^^^^^^
65
-
66
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
18
+
error: used `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
27
+
= help: `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
76
28
note: return Err() instead of panicking
77
29
--> $DIR/panic_in_result_fn.rs:54:5
78
30
|
79
31
LL | panic!("error");
80
32
| ^^^^^^^^^^^^^^^
81
33
82
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
83
-
--> $DIR/panic_in_result_fn.rs:67:1
84
-
|
85
-
LL | / fn main() -> Result<(), String> {
86
-
LL | | todo!("finish main method");
87
-
LL | | Ok(())
88
-
LL | | }
89
-
| |_^
90
-
|
91
-
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
11
+
= help: `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
12
12
note: return Err() instead of panicking
13
13
--> $DIR/panic_in_result_fn_assertions.rs:9:9
14
14
|
15
15
LL | assert!(x == 5, "wrong argument");
16
16
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17
17
= note: `-D clippy::panic-in-result-fn` implied by `-D warnings`
18
18
19
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
19
+
error: used `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
29
+
= help: `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
30
30
note: return Err() instead of panicking
31
31
--> $DIR/panic_in_result_fn_assertions.rs:15:9
32
32
|
33
33
LL | assert_eq!(x, 5);
34
34
| ^^^^^^^^^^^^^^^^
35
35
36
-
error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
36
+
error: used `panic!()` or assertion in a function that returns `Result`
= help: `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
46
+
= help: `panic!()` or assertions should not be used in a function that returns `Result` as `Result` is expected to return an error instead of crashing
0 commit comments