From 9e27796fad3f89a75ac0b05101688052893dd467 Mon Sep 17 00:00:00 2001 From: Jonathan Woollett-Light Date: Mon, 9 Oct 2023 18:46:07 +0100 Subject: [PATCH] tests: Warn on `clippy::as_conversions` `clippy::ptr_as_ptr`, `clippy::cast_lossless`, `clippy::cast_possible_truncation`, `clippy::cast_possible_wrap` and `clippy::cast_sign_loss` are all enabled by `clippy::as_conversions`, with them all enabled we can now remove them and simply warn on `clippy::as_conversions`. Signed-off-by: Jonathan Woollett-Light --- .cargo/config | 6 +----- src/net_gen/src/if_tun.rs | 2 +- src/net_gen/src/iff.rs | 2 +- src/net_gen/src/sockios.rs | 2 +- src/virtio_gen/src/virtio_blk.rs | 2 +- src/virtio_gen/src/virtio_net.rs | 2 +- src/virtio_gen/src/virtio_ring.rs | 2 +- src/virtio_gen/src/virtio_rng.rs | 2 +- src/vmm/src/arch_gen/x86/hyperv.rs | 2 +- src/vmm/src/arch_gen/x86/hyperv_tlfs.rs | 2 +- src/vmm/src/arch_gen/x86/msr_index.rs | 5 ++--- src/vmm/src/arch_gen/x86/perf_event.rs | 5 ++--- tools/bindgen.sh | 3 +-- 13 files changed, 15 insertions(+), 22 deletions(-) diff --git a/.cargo/config b/.cargo/config index 975dda6de2b..57eac83cd29 100644 --- a/.cargo/config +++ b/.cargo/config @@ -1,12 +1,8 @@ [build] target-dir = "build/cargo_target" rustflags = [ - "-Wclippy::ptr_as_ptr", + "-Wclippy::as_conversions", "-Wclippy::undocumented_unsafe_blocks", - "-Wclippy::cast_lossless", - "-Wclippy::cast_possible_truncation", - "-Wclippy::cast_possible_wrap", - "-Wclippy::cast_sign_loss", "-Wmissing_debug_implementations", "-Wclippy::exit", ] diff --git a/src/net_gen/src/if_tun.rs b/src/net_gen/src/if_tun.rs index 3f6db32e2c0..a58e1de6ce9 100644 --- a/src/net_gen/src/if_tun.rs +++ b/src/net_gen/src/if_tun.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/net_gen/src/iff.rs b/src/net_gen/src/iff.rs index ca1dbd76128..9514aa7dd23 100644 --- a/src/net_gen/src/iff.rs +++ b/src/net_gen/src/iff.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/net_gen/src/sockios.rs b/src/net_gen/src/sockios.rs index b6c0f9bac4b..46f85cd2b74 100644 --- a/src/net_gen/src/sockios.rs +++ b/src/net_gen/src/sockios.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/virtio_gen/src/virtio_blk.rs b/src/virtio_gen/src/virtio_blk.rs index 960ac506712..ad4215d04c1 100644 --- a/src/virtio_gen/src/virtio_blk.rs +++ b/src/virtio_gen/src/virtio_blk.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/virtio_gen/src/virtio_net.rs b/src/virtio_gen/src/virtio_net.rs index c5005941fe5..3fce91eb68a 100644 --- a/src/virtio_gen/src/virtio_net.rs +++ b/src/virtio_gen/src/virtio_net.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/virtio_gen/src/virtio_ring.rs b/src/virtio_gen/src/virtio_ring.rs index 3bd607f5025..3b469bd636f 100644 --- a/src/virtio_gen/src/virtio_ring.rs +++ b/src/virtio_gen/src/virtio_ring.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/virtio_gen/src/virtio_rng.rs b/src/virtio_gen/src/virtio_rng.rs index 7f81407c12d..1701f0b9b1a 100644 --- a/src/virtio_gen/src/virtio_rng.rs +++ b/src/virtio_gen/src/virtio_rng.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, missing_debug_implementations )] diff --git a/src/vmm/src/arch_gen/x86/hyperv.rs b/src/vmm/src/arch_gen/x86/hyperv.rs index c9235c0240a..263b0cd28c6 100644 --- a/src/vmm/src/arch_gen/x86/hyperv.rs +++ b/src/vmm/src/arch_gen/x86/hyperv.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, clippy::cast_lossless )] diff --git a/src/vmm/src/arch_gen/x86/hyperv_tlfs.rs b/src/vmm/src/arch_gen/x86/hyperv_tlfs.rs index 453d1ce1452..71a4fcc9d66 100644 --- a/src/vmm/src/arch_gen/x86/hyperv_tlfs.rs +++ b/src/vmm/src/arch_gen/x86/hyperv_tlfs.rs @@ -8,7 +8,7 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, clippy::cast_lossless )] diff --git a/src/vmm/src/arch_gen/x86/msr_index.rs b/src/vmm/src/arch_gen/x86/msr_index.rs index b3fa07c9ac4..076cfde93c9 100644 --- a/src/vmm/src/arch_gen/x86/msr_index.rs +++ b/src/vmm/src/arch_gen/x86/msr_index.rs @@ -8,9 +8,8 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, - clippy::undocumented_unsafe_blocks, - clippy::cast_lossless + clippy::as_conversions, + clippy::undocumented_unsafe_blocks )] pub const MSR_EFER: u32 = 0xc0000080; diff --git a/src/vmm/src/arch_gen/x86/perf_event.rs b/src/vmm/src/arch_gen/x86/perf_event.rs index 341ed7e8551..e4c1f734946 100644 --- a/src/vmm/src/arch_gen/x86/perf_event.rs +++ b/src/vmm/src/arch_gen/x86/perf_event.rs @@ -8,9 +8,8 @@ non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, - clippy::undocumented_unsafe_blocks, - clippy::cast_lossless + clippy::as_conversions, + clippy::undocumented_unsafe_blocks )] pub const MSR_ARCH_PERFMON_PERFCTR0: u32 = 0xc1; diff --git a/tools/bindgen.sh b/tools/bindgen.sh index 67a9f59d949..4db18e46efc 100755 --- a/tools/bindgen.sh +++ b/tools/bindgen.sh @@ -31,9 +31,8 @@ function fc-bindgen { non_upper_case_globals, dead_code, non_snake_case, - clippy::ptr_as_ptr, + clippy::as_conversions, clippy::undocumented_unsafe_blocks, - clippy::cast_lossless, missing_debug_implementations )]