]> git.lizzy.rs Git - rust.git/blob - tests/ui/panic_in_result_fn_assertions.stderr
Addition `manual_map` test for `unsafe` blocks
[rust.git] / tests / ui / panic_in_result_fn_assertions.stderr
1 error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
2   --> $DIR/panic_in_result_fn_assertions.rs:7:5
3    |
4 LL | /     fn result_with_assert_with_message(x: i32) -> Result<bool, String> // should emit lint
5 LL | |     {
6 LL | |         assert!(x == 5, "wrong argument");
7 LL | |         Ok(true)
8 LL | |     }
9    | |_____^
10    |
11    = note: `-D clippy::panic-in-result-fn` implied by `-D warnings`
12    = 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
13 note: return Err() instead of panicking
14   --> $DIR/panic_in_result_fn_assertions.rs:9:9
15    |
16 LL |         assert!(x == 5, "wrong argument");
17    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
18    = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
19
20 error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
21   --> $DIR/panic_in_result_fn_assertions.rs:13:5
22    |
23 LL | /     fn result_with_assert_eq(x: i32) -> Result<bool, String> // should emit lint
24 LL | |     {
25 LL | |         assert_eq!(x, 5);
26 LL | |         Ok(true)
27 LL | |     }
28    | |_____^
29    |
30    = 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
31 note: return Err() instead of panicking
32   --> $DIR/panic_in_result_fn_assertions.rs:15:9
33    |
34 LL |         assert_eq!(x, 5);
35    |         ^^^^^^^^^^^^^^^^
36    = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
37
38 error: used `unimplemented!()`, `unreachable!()`, `todo!()`, `panic!()` or assertion in a function that returns `Result`
39   --> $DIR/panic_in_result_fn_assertions.rs:19:5
40    |
41 LL | /     fn result_with_assert_ne(x: i32) -> Result<bool, String> // should emit lint
42 LL | |     {
43 LL | |         assert_ne!(x, 1);
44 LL | |         Ok(true)
45 LL | |     }
46    | |_____^
47    |
48    = 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
49 note: return Err() instead of panicking
50   --> $DIR/panic_in_result_fn_assertions.rs:21:9
51    |
52 LL |         assert_ne!(x, 1);
53    |         ^^^^^^^^^^^^^^^^
54    = note: this error originates in the macro `assert_ne` (in Nightly builds, run with -Z macro-backtrace for more info)
55
56 error: aborting due to 3 previous errors
57