From ca048523f408b43d711c4f9cb8fec6cdeee94e7d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 6 Feb 2025 02:50:01 +0900 Subject: [PATCH] tests: Apply more lints to no-std tests --- Cargo.toml | 4 +-- tests/avr/Cargo.toml | 54 +++++++++++++++++++++++++++++++-- tests/avr/src/main.rs | 1 + tests/m68k/Cargo.toml | 54 +++++++++++++++++++++++++++++++-- tests/m68k/src/main.rs | 1 + tests/msp430/Cargo.toml | 54 +++++++++++++++++++++++++++++++-- tests/msp430/src/main.rs | 17 +++++------ tests/no-std-qemu/Cargo.toml | 56 +++++++++++++++++++++++++++++++++-- tests/no-std-qemu/src/main.rs | 1 + tests/sparc/Cargo.toml | 54 +++++++++++++++++++++++++++++++-- tests/sparc/src/main.rs | 2 ++ tests/xtensa/Cargo.toml | 54 +++++++++++++++++++++++++++++++-- tests/xtensa/src/main.rs | 1 + 13 files changed, 329 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6f365754..f0eac532 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,7 @@ workspace = true resolver = "2" # This table is shared by projects under github.com/taiki-e. -# It is not intended for manual editing. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. [workspace.lints.rust] deprecated_safe = "warn" improper_ctypes = "warn" @@ -87,7 +87,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [ ] } unnameable_types = "warn" unreachable_pub = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV [workspace.lints.clippy] all = "warn" # Downgrade deny-by-default lints pedantic = "warn" diff --git a/tests/avr/Cargo.toml b/tests/avr/Cargo.toml index b1dcaa44..ef6b96b0 100644 --- a/tests/avr/Cargo.toml +++ b/tests/avr/Cargo.toml @@ -2,6 +2,7 @@ name = "avr-test" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [dependencies] @@ -13,13 +14,62 @@ ufmt = "0.2" [target.avr-unknown-gnu-atmega2560.dependencies] arduino-hal = { features = ["arduino-mega2560"], git = "https://github.com/taiki-e/avr-hal.git", rev = "352567e" } +[lints] +workspace = true + [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } [profile.dev] codegen-units = 1 diff --git a/tests/avr/src/main.rs b/tests/avr/src/main.rs index f059503d..a6144639 100644 --- a/tests/avr/src/main.rs +++ b/tests/avr/src/main.rs @@ -3,6 +3,7 @@ #![no_main] #![no_std] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] use core::{mem::MaybeUninit, sync::atomic::Ordering}; diff --git a/tests/m68k/Cargo.toml b/tests/m68k/Cargo.toml index 524a85bd..59b25bf7 100644 --- a/tests/m68k/Cargo.toml +++ b/tests/m68k/Cargo.toml @@ -2,6 +2,7 @@ name = "no-core" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [features] @@ -24,13 +25,62 @@ u64 = [] core = { path = "rust-src/core" } paste = "1" +[lints] +workspace = true + [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } [profile.dev] codegen-units = 1 diff --git a/tests/m68k/src/main.rs b/tests/m68k/src/main.rs index 52ea11a8..f99b1541 100644 --- a/tests/m68k/src/main.rs +++ b/tests/m68k/src/main.rs @@ -5,6 +5,7 @@ #![no_main] #![no_core] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] #![cfg_attr(atomic_maybe_uninit_no_strict_provenance, allow(unstable_name_collisions))] #[macro_use] diff --git a/tests/msp430/Cargo.toml b/tests/msp430/Cargo.toml index 32a26597..8e03e094 100644 --- a/tests/msp430/Cargo.toml +++ b/tests/msp430/Cargo.toml @@ -2,6 +2,7 @@ name = "msp430-test" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [dependencies] @@ -12,13 +13,62 @@ msp430f5529 = { features = ["rt"], git = "https://github.com/cr1901/msp430f5529. paste = "1" ufmt = "0.2" +[lints] +workspace = true + [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } [profile.dev] codegen-units = 1 diff --git a/tests/msp430/src/main.rs b/tests/msp430/src/main.rs index 38784003..ce884632 100644 --- a/tests/msp430/src/main.rs +++ b/tests/msp430/src/main.rs @@ -3,6 +3,7 @@ #![no_main] #![no_std] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] use core::{mem::MaybeUninit, sync::atomic::Ordering}; @@ -236,25 +237,23 @@ mod simio { use core::{convert::Infallible, fmt}; pub struct Console; - impl Console { - fn write_str(&mut self, s: &str) { - // https://github.com/dlbeer/mspdebug/blob/v0.25/simio/simio_console.c#L130 - let addr = 0x00FF_usize as *mut u8; - for &b in s.as_bytes() { - unsafe { addr.write_volatile(b) } - } + fn write_str(s: &str) { + // https://github.com/dlbeer/mspdebug/blob/v0.25/simio/simio_console.c#L130 + let addr = 0x00FF_usize as *mut u8; + for &b in s.as_bytes() { + unsafe { addr.write_volatile(b) } } } impl ufmt::uWrite for Console { type Error = Infallible; fn write_str(&mut self, s: &str) -> Result<(), Self::Error> { - self.write_str(s); + write_str(s); Ok(()) } } impl fmt::Write for Console { fn write_str(&mut self, s: &str) -> fmt::Result { - self.write_str(s); + write_str(s); Ok(()) } } diff --git a/tests/no-std-qemu/Cargo.toml b/tests/no-std-qemu/Cargo.toml index cf47d1ab..82841749 100644 --- a/tests/no-std-qemu/Cargo.toml +++ b/tests/no-std-qemu/Cargo.toml @@ -2,6 +2,7 @@ name = "no-std-qemu-test" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [dependencies] @@ -9,12 +10,61 @@ atomic-maybe-uninit = { path = "../.." } paste = "1" semihosting = { version = "0.1", features = ["stdio", "panic-handler"] } -semihosting-no-std-test-rt = { features = ["qemu-system"], git = "https://github.com/taiki-e/semihosting.git", rev = "3874a1e" } +semihosting-no-std-test-rt = { features = ["qemu-system"], git = "https://github.com/taiki-e/semihosting.git", rev = "f22ca36" } + +[lints] +workspace = true [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } diff --git a/tests/no-std-qemu/src/main.rs b/tests/no-std-qemu/src/main.rs index e1c1ddfb..df788aa3 100644 --- a/tests/no-std-qemu/src/main.rs +++ b/tests/no-std-qemu/src/main.rs @@ -3,6 +3,7 @@ #![no_main] #![no_std] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] use core::{mem::MaybeUninit, sync::atomic::Ordering}; diff --git a/tests/sparc/Cargo.toml b/tests/sparc/Cargo.toml index d8c62fa7..e8a76cba 100644 --- a/tests/sparc/Cargo.toml +++ b/tests/sparc/Cargo.toml @@ -2,6 +2,7 @@ name = "sparc-test" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [dependencies] @@ -9,10 +10,59 @@ atomic-maybe-uninit = { path = "../.." } paste = "1" +[lints] +workspace = true + [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } diff --git a/tests/sparc/src/main.rs b/tests/sparc/src/main.rs index 4cd8679c..6d3a4da2 100644 --- a/tests/sparc/src/main.rs +++ b/tests/sparc/src/main.rs @@ -3,6 +3,8 @@ #![no_main] #![no_std] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] +#![allow(clippy::used_underscore_items)] // https://github.com/rust-lang/rust-clippy/issues/14156 use core::{mem::MaybeUninit, sync::atomic::Ordering}; diff --git a/tests/xtensa/Cargo.toml b/tests/xtensa/Cargo.toml index 407b9ca1..2351a71b 100644 --- a/tests/xtensa/Cargo.toml +++ b/tests/xtensa/Cargo.toml @@ -2,6 +2,7 @@ name = "xtensa-test" version = "0.0.0" edition = "2021" +rust-version = "1.64" # Prevent clippy from suggesting a code that requires a new version. publish = false [dependencies] @@ -19,13 +20,62 @@ esp-hal = { version = "0.23", features = ["esp32s2"] } esp-println = { version = "0.12", default-features = false, features = ["uart", "esp32s3"] } esp-hal = { version = "0.23", features = ["esp32s3"] } +[lints] +workspace = true + [workspace] resolver = "2" -[lints.rust] +# This table is shared by projects under github.com/taiki-e. +# Expect for unexpected_cfgs.check-cfg, it is not intended for manual editing. +[workspace.lints.rust] +deprecated_safe = "warn" +improper_ctypes = "warn" +improper_ctypes_definitions = "warn" +non_ascii_idents = "warn" rust_2018_idioms = "warn" single_use_lifetimes = "warn" -# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 is not available on MSRV +unexpected_cfgs = { level = "warn", check-cfg = [ +] } +# unnameable_types = "warn" +# unreachable_pub = "warn" +# unsafe_op_in_unsafe_fn = "warn" # Set at crate-level instead since https://github.com/rust-lang/rust/pull/100081 merged in Rust 1.65 is not available on MSRV +[workspace.lints.clippy] +all = "warn" # Downgrade deny-by-default lints +pedantic = "warn" +as_ptr_cast_mut = "warn" +as_underscore = "warn" +default_union_representation = "warn" +inline_asm_x86_att_syntax = "warn" +trailing_empty_array = "warn" +transmute_undefined_repr = "warn" +undocumented_unsafe_blocks = "warn" +unused_trait_names = "warn" +# Suppress buggy or noisy clippy lints +bool_assert_comparison = { level = "allow", priority = 1 } +borrow_as_ptr = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/8286 +cast_lossless = { level = "allow", priority = 1 } # https://godbolt.org/z/Pv6vbGG6E +declare_interior_mutable_const = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7665 +doc_markdown = { level = "allow", priority = 1 } +float_cmp = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/7725 +incompatible_msrv = { level = "allow", priority = 1 } # buggy: doesn't consider cfg, https://github.com/rust-lang/rust-clippy/issues/12280, https://github.com/rust-lang/rust-clippy/issues/12257#issuecomment-2093667187 +lint_groups_priority = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/12920 +manual_assert = { level = "allow", priority = 1 } +manual_range_contains = { level = "allow", priority = 1 } # https://github.com/rust-lang/rust-clippy/issues/6455#issuecomment-1225966395 +missing_errors_doc = { level = "allow", priority = 1 } +module_name_repetitions = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+module_name_repetitions +naive_bytecount = { level = "allow", priority = 1 } +nonminimal_bool = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+nonminimal_bool +range_plus_one = { level = "allow", priority = 1 } # buggy: https://github.com/rust-lang/rust-clippy/issues?q=is%3Aissue+is%3Aopen+range_plus_one +similar_names = { level = "allow", priority = 1 } +single_match = { level = "allow", priority = 1 } +single_match_else = { level = "allow", priority = 1 } +struct_excessive_bools = { level = "allow", priority = 1 } +struct_field_names = { level = "allow", priority = 1 } +too_many_arguments = { level = "allow", priority = 1 } +too_many_lines = { level = "allow", priority = 1 } +type_complexity = { level = "allow", priority = 1 } +unreadable_literal = { level = "allow", priority = 1 } [profile.dev] opt-level = 'z' diff --git a/tests/xtensa/src/main.rs b/tests/xtensa/src/main.rs index 0ec3fdeb..c09e264e 100644 --- a/tests/xtensa/src/main.rs +++ b/tests/xtensa/src/main.rs @@ -3,6 +3,7 @@ #![no_main] #![no_std] #![warn(unsafe_op_in_unsafe_fn)] +#![allow(clippy::undocumented_unsafe_blocks, clippy::wildcard_imports)] use core::{mem::MaybeUninit, sync::atomic::Ordering};