From 8dae8bdf72c005ad5e0422e535b996ebbffbc9c7 Mon Sep 17 00:00:00 2001 From: Tim Oram Date: Wed, 19 Jul 2023 11:31:59 -0230 Subject: [PATCH] Update smoke test to verify all Clippy/rustc lints Update the smoke test to include all lints and address any issues discovered. --- src/lib.rs | 4 ++- tests/smoke-test/src/main.rs | 55 +++++++++++++++++++++++++++++++++--- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ffeef79b..15bdb70a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -590,7 +590,9 @@ macro_rules! bitflags { unused_mut, unused_imports, non_upper_case_globals, - clippy::assign_op_pattern + clippy::assign_op_pattern, + clippy::indexing_slicing, + clippy::same_name_method )] const _: () = { // Declared in a "hidden" scope that can't be reached directly diff --git a/tests/smoke-test/src/main.rs b/tests/smoke-test/src/main.rs index 5f14a0c0..c5d84647 100644 --- a/tests/smoke-test/src/main.rs +++ b/tests/smoke-test/src/main.rs @@ -1,19 +1,66 @@ -#![deny(warnings)] +#![allow(unknown_lints)] +#![deny(clippy::all, clippy::pedantic, clippy::restriction)] +#![allow(clippy::blanket_clippy_restriction_lints)] +// deny all rustc's built-in lints +#![deny( + warnings, + future_incompatible, + let_underscore, + nonstandard_style, + rust_2018_compatibility, + rust_2018_idioms, + rust_2021_compatibility, + unused +)] +// deny additional allow by default from rustc +#![deny( + deprecated_in_future, + ffi_unwind_calls, + macro_use_extern_crate, + meta_variable_misuse, + missing_abi, + missing_copy_implementations, + missing_debug_implementations, + missing_docs, + non_ascii_idents, + noop_method_call, + single_use_lifetimes, + trivial_casts, + trivial_numeric_casts, + unreachable_pub, + unsafe_code, + unsafe_op_in_unsafe_fn, + unused_crate_dependencies, + unused_import_braces, + unused_lifetimes, + unused_qualifications, + unused_results, + unused_tuple_struct_fields, + variant_size_differences +)] + +//! An example file for smoke tests use bitflags::bitflags; bitflags! { #[derive(Debug)] + /// Example Flags pub struct Flags: u32 { - const A = 0b00000001; - const B = 0b00000010; - const C = 0b00000100; + /// A + const A = 0b0000_0001; + /// B + const B = 0b0000_0010; + /// C + const C = 0b0000_0100; + /// ABC const ABC = Flags::A.bits() | Flags::B.bits() | Flags::C.bits(); const _ = !0; } } +#[allow(clippy::print_stdout, clippy::use_debug)] fn main() { println!("{:?}", Flags::ABC); }