Use verbose suggestion for ptr::null_mut()

This commit is contained in:
Esteban Küber 2024-07-05 20:38:16 +00:00
parent c422581297
commit fca286a39e
2 changed files with 7 additions and 4 deletions

View File

@ -501,6 +501,7 @@ pub enum SuggestBoxing {
#[suggestion(
hir_typeck_suggest_ptr_null_mut,
applicability = "maybe-incorrect",
style = "verbose",
code = "core::ptr::null_mut()"
)]
pub struct SuggestPtrNullMut {

View File

@ -2,10 +2,8 @@ error[E0308]: mismatched types
--> $DIR/ptr-null-mutability-suggestions.rs:9:24
|
LL | expecting_null_mut(ptr::null());
| ------------------ ^^^^^^^^^^^
| | |
| | types differ in mutability
| | help: consider using `core::ptr::null_mut` instead: `core::ptr::null_mut()`
| ------------------ ^^^^^^^^^^^ types differ in mutability
| |
| arguments to this function are incorrect
|
= note: expected raw pointer `*mut u8`
@ -15,6 +13,10 @@ note: function defined here
|
LL | fn expecting_null_mut(_: *mut u8) {}
| ^^^^^^^^^^^^^^^^^^ ----------
help: consider using `core::ptr::null_mut` instead
|
LL | expecting_null_mut(core::ptr::null_mut());
| ~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 1 previous error