diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e012854..9a59717 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -33,4 +33,4 @@ jobs: toolchain: nightly override: true components: clippy - - run: cargo clippy -- -D warnings + - run: cargo clippy --all --all-targets -- -D warnings diff --git a/Cargo.toml b/Cargo.toml index 3dc54c9..6b2b92c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,13 +23,13 @@ optional = true [features] std = [] -#[dev-dependencies] -#criterion = "0.3" -# -#[[bench]] -#name = "from_iterator" -#harness = false -#path = "benches/from_iterator.rs" +[dev-dependencies] +criterion = "0.3" + +[[bench]] +name = "from_iterator" +harness = false +path = "benches/from_iterator.rs" [workspace] members = [ diff --git a/test_suite/common.rs b/test_suite/common.rs index c8cc4eb..d1a6920 100644 --- a/test_suite/common.rs +++ b/test_suite/common.rs @@ -86,7 +86,7 @@ fn iterator() { ]; for &(bitflag, expected) in tests { - assert!(bitflag.iter().zip(expected.iter().cloned()).all(|(a, b)| a == b)); + assert!(bitflag.iter().zip(expected.iter().copied()).all(|(a, b)| a == b)); // If cloned, the iterator will yield the same elements. let it = bitflag.iter(); assert!(it.clone().zip(it).all(|(a, b)| a == b)); @@ -109,7 +109,7 @@ fn assign_ops() { } #[test] -fn fn_derive() { +const fn fn_derive() { #[bitflags] #[derive(Copy, Clone, Debug)] #[repr(u8)] @@ -119,7 +119,7 @@ fn fn_derive() { } #[test] -fn module() { +const fn module() { mod some_modules { #[enumflags2::bitflags] #[derive(Copy, Clone, Debug)] @@ -145,9 +145,6 @@ fn inferred_values() { SpecifiedB = 4, } - assert_eq!(Inferred::Infer2 as u8, 2); - assert_eq!(Inferred::Infer8 as u8, 8); - #[bitflags] #[derive(Copy, Clone, Debug)] #[repr(u8)] @@ -158,6 +155,9 @@ fn inferred_values() { Infer8, } + assert_eq!(Inferred::Infer2 as u8, 2); + assert_eq!(Inferred::Infer8 as u8, 8); + assert_eq!(OnlyInferred::Infer1 as u8, 1); assert_eq!(OnlyInferred::Infer2 as u8, 2); assert_eq!(OnlyInferred::Infer4 as u8, 4); diff --git a/test_suite/tests/bitflag_tests_2018.rs b/test_suite/tests/bitflag_tests_2018.rs index 9fffddb..07f55f9 100644 --- a/test_suite/tests/bitflag_tests_2018.rs +++ b/test_suite/tests/bitflag_tests_2018.rs @@ -1,3 +1,8 @@ -use enumflags2::bitflags; +// "an inner attribute is not permitted in this context" :/ +#[deny(clippy::all, clippy::pedantic, clippy::nursery)] +mod everything { -include!("../common.rs"); + use enumflags2::bitflags; + + include!("../common.rs"); +}