rust-clippy/tests/ui/fn_null_check.stderr

44 lines
1.8 KiB
Text
Raw Normal View History

2022-12-17 23:16:04 +00:00
error: function pointer assumed to be nullable, even though it isn't
2023-06-10 11:43:30 +00:00
--> $DIR/fn_null_check.rs:14:8
2022-12-17 23:16:04 +00:00
|
LL | if (fn_ptr as *mut ()).is_null() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
= note: `-D clippy::fn-null-check` implied by `-D warnings`
error: function pointer assumed to be nullable, even though it isn't
2023-06-10 11:43:30 +00:00
--> $DIR/fn_null_check.rs:15:8
2022-12-17 23:16:04 +00:00
|
LL | if (fn_ptr as *const u8).is_null() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
error: function pointer assumed to be nullable, even though it isn't
2023-06-10 11:43:30 +00:00
--> $DIR/fn_null_check.rs:16:8
2022-12-17 23:16:04 +00:00
|
LL | if (fn_ptr as *const ()) == std::ptr::null() {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
error: function pointer assumed to be nullable, even though it isn't
2023-06-10 11:43:30 +00:00
--> $DIR/fn_null_check.rs:17:8
2022-12-17 23:16:04 +00:00
|
LL | if (fn_ptr as *const ()) == (0 as *const ()) {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
error: function pointer assumed to be nullable, even though it isn't
2023-06-10 11:43:30 +00:00
--> $DIR/fn_null_check.rs:18:8
2022-12-17 23:16:04 +00:00
|
LL | if (fn_ptr as *const ()) == ZPTR {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: try wrapping your function pointer type in `Option<T>` instead, and using `is_none` to check for null pointer value
error: aborting due to 5 previous errors