bors b3145fea6a Auto merge of #10099 - Niki4tap:null_fn_lints, r=llogiq
Null fn lints

Adds lints to check for code, that assumes nullable `fn()`.

### Lint examples:

`transmute_null_to_fn`:
```rust
error: transmuting a known null pointer into a function pointer
  --> $DIR/transmute_null_to_fn.rs:9:23
   |
LL |         let _: fn() = std::mem::transmute(std::ptr::null::<()>());
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this transmute results in undefined behavior
   |
   = help: try wrapping your function pointer type in `Option<T>` instead, and using `None` as a null pointer value
```

`fn_null_check`:
```rust
error: function pointer assumed to be nullable, even though it isn't
  --> $DIR/fn_null_check.rs:13:8
   |
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
```

Closes #1644

---

changelog: Improvement: [`transmuting_null`]: Now detects `const` pointers to all types
[#10099](https://github.com/rust-lang/rust-clippy/pull/10099)
changelog: New lint: [`transmute_null_to_fn`]
[#10099](https://github.com/rust-lang/rust-clippy/pull/10099)
changelog: New lint: [`fn_null_check`]
[#10099](https://github.com/rust-lang/rust-clippy/pull/10099)
<!-- changelog_checked (This is just a flag for me, please don't add it manually) -->
2022-12-19 12:44:23 +00:00
..
2022-12-09 13:29:50 -05:00
2022-11-28 00:41:31 -08:00
2022-10-19 11:34:00 -07:00
2022-12-18 03:02:45 +03:00
2022-12-18 03:02:45 +03:00
2022-10-09 13:07:21 +00:00
2022-12-03 16:06:57 +08:00
2022-12-03 16:06:57 +08:00
2022-11-30 19:42:50 +06:00
2022-11-30 19:42:50 +06:00
2022-11-30 19:42:50 +06:00
2022-12-13 21:43:16 +08:00
2022-12-09 13:29:50 -05:00
2022-12-09 13:29:50 -05:00
2022-12-09 13:29:50 -05:00
2022-10-26 13:41:57 +02:00
2022-10-26 13:41:57 +02:00
2022-12-02 20:48:18 -05:00
2022-12-02 20:48:18 -05:00