Skip to content

Commit

Permalink
fix: disable clippy::cast_lossless lint
Browse files Browse the repository at this point in the history
With the new toolchain, this lint fires inside macros, such as
`arm64_core_reg_id`. However, this macro is uses in `const` contexts,
and the suggested replacement `u64::from` is not a const function, so is
not applicable. Furthermore, we also cannot suppress the lint here, as
annotating expressions (such as the body of the `arm64_core_reg_id`
macro) with attributes is not allowed on stable compilers. Thus, it is
impossible to address this warning.

We can safely disable this specific lint though, as it is not gaining us
anything anyway: It explicitly disallows lossless conversions, e.g.
those that are always safe. The justification here is that "if types
ever change, these conversions can become silently lossly", however that
does not apply in our case, as we explicitly disable all lossly
conversions. Thus, disable this lint.

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
  • Loading branch information
roypat committed Jul 16, 2024
1 parent 7282ab6 commit f4fdb55
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 14 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ missing_debug_implementations = "warn"
[workspace.lints.clippy]
ptr_as_ptr = "warn"
undocumented_unsafe_blocks = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_sign_loss = "warn"
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/arch_gen/x86/hyperv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/arch_gen/x86/hyperv_tlfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/arch_gen/x86/mpspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/arch_gen/x86/msr_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/arch_gen/x86/perf_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/gen/virtio_blk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/gen/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/gen/virtio_ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/gen/virtio_rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/net/gen/if_tun.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/net/gen/iff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/devices/virtio/net/gen/sockios.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down
1 change: 0 additions & 1 deletion src/vmm/src/io_uring/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
non_snake_case,
clippy::ptr_as_ptr,
clippy::undocumented_unsafe_blocks,
clippy::cast_lossless,
missing_debug_implementations,
clippy::tests_outside_test_module
)]
Expand Down

0 comments on commit f4fdb55

Please sign in to comment.