From 2181d59b2a7a846dbc5463aa9e2ac966fe481058 Mon Sep 17 00:00:00 2001 From: Manos Pitsidianakis Date: Sun, 19 Nov 2023 14:18:00 +0200 Subject: [PATCH] Add [workspace.lints] to manifests From Rust 1.74 and onwards, this section enables opt-in lints for crates of this workspace. Read more information at https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html For a crate to opt-in, it needs to set [lints] workspace = true In its Cargo.toml Closes #518 Signed-off-by: Manos Pitsidianakis --- Cargo.toml | 35 +++++++++++++++++++++++++++++++++++ staging/Cargo.toml | 35 +++++++++++++++++++++++++++++++++++ vhost-device-sound/Cargo.toml | 3 +++ 3 files changed, 73 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index b0d010ddd..7b591767d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,38 @@ members = [ "vhost-device-template", "vhost-device-vsock", ] + +[workspace.lints.rust] +unsafe_op_in_unsafe_fn = "deny" + +[workspace.lints.rustdoc] +broken_intra_doc_links = "deny" +redundant_explicit_links = "deny" + +[workspace.lints.clippy] +enum_glob_use = "deny" +# groups +correctness = { level = "deny", priority = -1 } +suspicious = { level = "deny", priority = -1 } +complexity = { level = "deny", priority = -1 } +perf = { level = "deny", priority = -1 } +style = { level = "deny", priority = -1 } +nursery = { level = "deny", priority = -1 } +# restriction +dbg_macro = "deny" +rc_buffer = "deny" +as_underscore = "deny" +assertions_on_result_states = "deny" +# pedantic +cast_lossless = "deny" +cast_possible_wrap = "deny" +cast_ptr_alignment = "deny" +naive_bytecount = "deny" +ptr_as_ptr = "deny" +bool_to_int_with_if = "deny" +borrow_as_ptr = "deny" +case_sensitive_file_extension_comparisons = "deny" +significant_drop_in_scrutinee = "allow" +significant_drop_tightening = "allow" +missing_safety_doc = "deny" +undocumented_unsafe_blocks = "deny" diff --git a/staging/Cargo.toml b/staging/Cargo.toml index 88d416856..dd5d60253 100644 --- a/staging/Cargo.toml +++ b/staging/Cargo.toml @@ -5,3 +5,38 @@ members = [ "vhost-device-can", "vhost-device-console", ] + +[workspace.lints.rust] +unsafe_op_in_unsafe_fn = "deny" + +[workspace.lints.rustdoc] +broken_intra_doc_links = "deny" +redundant_explicit_links = "deny" + +[workspace.lints.clippy] +enum_glob_use = "deny" +# groups +correctness = { level = "deny", priority = -1 } +suspicious = { level = "deny", priority = -1 } +complexity = { level = "deny", priority = -1 } +perf = { level = "deny", priority = -1 } +style = { level = "deny", priority = -1 } +nursery = { level = "deny", priority = -1 } +# restriction +dbg_macro = "deny" +rc_buffer = "deny" +as_underscore = "deny" +assertions_on_result_states = "deny" +# pedantic +cast_lossless = "deny" +cast_possible_wrap = "deny" +cast_ptr_alignment = "deny" +naive_bytecount = "deny" +ptr_as_ptr = "deny" +bool_to_int_with_if = "deny" +borrow_as_ptr = "deny" +case_sensitive_file_extension_comparisons = "deny" +significant_drop_in_scrutinee = "allow" +significant_drop_tightening = "allow" +missing_safety_doc = "deny" +undocumented_unsafe_blocks = "deny" diff --git a/vhost-device-sound/Cargo.toml b/vhost-device-sound/Cargo.toml index 47bffc1d5..2a9ec0195 100644 --- a/vhost-device-sound/Cargo.toml +++ b/vhost-device-sound/Cargo.toml @@ -10,6 +10,9 @@ categories = ["multimedia::audio", "virtualization"] license = "Apache-2.0 OR BSD-3-Clause" edition = "2018" +[lints] +workspace = true + [features] xen = ["vm-memory/xen", "vhost/xen", "vhost-user-backend/xen"] default = ["alsa-backend", "pw-backend"]