]> git.lizzy.rs Git - rust.git/blob - tests/ui/fn_null_check.stderr
Fix adjacent code
[rust.git] / tests / ui / fn_null_check.stderr
1 error: function pointer assumed to be nullable, even though it isn't
2   --> $DIR/fn_null_check.rs:13:8
3    |
4 LL |     if (fn_ptr as *mut ()).is_null() {}
5    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
8    = note: `-D clippy::fn-null-check` implied by `-D warnings`
9
10 error: function pointer assumed to be nullable, even though it isn't
11   --> $DIR/fn_null_check.rs:14:8
12    |
13 LL |     if (fn_ptr as *const u8).is_null() {}
14    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15    |
16    = help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
17
18 error: function pointer assumed to be nullable, even though it isn't
19   --> $DIR/fn_null_check.rs:15:8
20    |
21 LL |     if (fn_ptr as *const ()) == std::ptr::null() {}
22    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23    |
24    = help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
25
26 error: function pointer assumed to be nullable, even though it isn't
27   --> $DIR/fn_null_check.rs:16:8
28    |
29 LL |     if (fn_ptr as *const ()) == (0 as *const ()) {}
30    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31    |
32    = help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
33
34 error: function pointer assumed to be nullable, even though it isn't
35   --> $DIR/fn_null_check.rs:17:8
36    |
37 LL |     if (fn_ptr as *const ()) == ZPTR {}
38    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39    |
40    = help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
41
42 error: aborting due to 5 previous errors
43