Skip to content

Commit 8f4f476

Browse files
authored
Rollup merge of rust-lang#113657 - Urgau:expand-incorrect_fn_null_check-lint, r=cjgillot
Expand, rename and improve `incorrect_fn_null_checks` lint This PR, - firstly, expand the lint by now linting on references - secondly, it renames the lint `incorrect_fn_null_checks` -> `useless_ptr_null_checks` - and thirdly it improves the lint by catching `ptr::from_mut`, `ptr::from_ref`, as well as `<*mut _>::cast` and `<*const _>::cast_mut` Fixes rust-lang#113601 cc ```@est31```
2 parents ff27f90 + 7ef1a54 commit 8f4f476

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

clippy_lints/src/renamed_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub static RENAMED_LINTS: &[(&str, &str)] = &[
4343
("clippy::for_loops_over_fallibles", "for_loops_over_fallibles"),
4444
("clippy::forget_copy", "forgetting_copy_types"),
4545
("clippy::forget_ref", "forgetting_references"),
46-
("clippy::fn_null_check", "incorrect_fn_null_checks"),
46+
("clippy::fn_null_check", "useless_ptr_null_checks"),
4747
("clippy::into_iter_on_array", "array_into_iter"),
4848
("clippy::invalid_atomic_ordering", "invalid_atomic_ordering"),
4949
("clippy::invalid_ref", "invalid_value"),

tests/ui/rename.fixed

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#![allow(for_loops_over_fallibles)]
3939
#![allow(forgetting_copy_types)]
4040
#![allow(forgetting_references)]
41-
#![allow(incorrect_fn_null_checks)]
41+
#![allow(useless_ptr_null_checks)]
4242
#![allow(array_into_iter)]
4343
#![allow(invalid_atomic_ordering)]
4444
#![allow(invalid_value)]
@@ -92,7 +92,7 @@
9292
#![warn(for_loops_over_fallibles)]
9393
#![warn(forgetting_copy_types)]
9494
#![warn(forgetting_references)]
95-
#![warn(incorrect_fn_null_checks)]
95+
#![warn(useless_ptr_null_checks)]
9696
#![warn(array_into_iter)]
9797
#![warn(invalid_atomic_ordering)]
9898
#![warn(invalid_value)]

tests/ui/rename.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#![allow(for_loops_over_fallibles)]
3939
#![allow(forgetting_copy_types)]
4040
#![allow(forgetting_references)]
41-
#![allow(incorrect_fn_null_checks)]
41+
#![allow(useless_ptr_null_checks)]
4242
#![allow(array_into_iter)]
4343
#![allow(invalid_atomic_ordering)]
4444
#![allow(invalid_value)]

tests/ui/rename.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ error: lint `clippy::forget_ref` has been renamed to `forgetting_references`
246246
LL | #![warn(clippy::forget_ref)]
247247
| ^^^^^^^^^^^^^^^^^^ help: use the new name: `forgetting_references`
248248

249-
error: lint `clippy::fn_null_check` has been renamed to `incorrect_fn_null_checks`
249+
error: lint `clippy::fn_null_check` has been renamed to `useless_ptr_null_checks`
250250
--> $DIR/rename.rs:95:9
251251
|
252252
LL | #![warn(clippy::fn_null_check)]
253-
| ^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `incorrect_fn_null_checks`
253+
| ^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `useless_ptr_null_checks`
254254

255255
error: lint `clippy::into_iter_on_array` has been renamed to `array_into_iter`
256256
--> $DIR/rename.rs:96:9

0 commit comments

Comments
 (0)