diff --git a/CHANGELOG.md b/CHANGELOG.md index ec5e63c2c8..a8a2d6dc4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed - Fixed clippy lints. -- Fixed `box_pool!` emitting clippy lints for `CamelCase` and `SNAKE_CASE`. +- Fixed `{arc,box,object}_pool!` emitting clippy lints for `CamelCase` and `SNAKE_CASE`. ## [v0.8.0] - 2023-11-07 diff --git a/src/pool/arc.rs b/src/pool/arc.rs index 218c4d2dd6..0c404adb48 100644 --- a/src/pool/arc.rs +++ b/src/pool/arc.rs @@ -83,12 +83,14 @@ use super::treiber::{NonNullPtr, Stack, UnionNode}; #[macro_export] macro_rules! arc_pool { ($name:ident: $data_type:ty) => { + #[allow(non_camel_case_types)] pub struct $name; impl $crate::pool::arc::ArcPool for $name { type Data = $data_type; fn singleton() -> &'static $crate::pool::arc::ArcPoolImpl<$data_type> { + #[allow(non_upper_case_globals)] static $name: $crate::pool::arc::ArcPoolImpl<$data_type> = $crate::pool::arc::ArcPoolImpl::new(); @@ -523,4 +525,11 @@ mod tests { let raw = &*arc as *const Zst4096; assert_eq!(0, raw as usize % 4096); } + + #[test] + fn arc_pool_case() { + // https://github.com/rust-embedded/heapless/issues/411 + arc_pool!(CamelCaseType: u128); + arc_pool!(SCREAMING_SNAKE_CASE_TYPE: u128); + } } diff --git a/src/pool/object.rs b/src/pool/object.rs index a12d69bfed..4dd4e0a18c 100644 --- a/src/pool/object.rs +++ b/src/pool/object.rs @@ -82,12 +82,14 @@ use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode}; #[macro_export] macro_rules! object_pool { ($name:ident: $data_type:ty) => { + #[allow(non_camel_case_types)] pub struct $name; impl $crate::pool::object::ObjectPool for $name { type Data = $data_type; fn singleton() -> &'static $crate::pool::object::ObjectPoolImpl<$data_type> { + #[allow(non_upper_case_globals)] static $name: $crate::pool::object::ObjectPoolImpl<$data_type> = $crate::pool::object::ObjectPoolImpl::new(); @@ -417,4 +419,11 @@ mod tests { let raw = &*object as *const Zst4096; assert_eq!(0, raw as usize % 4096); } + + #[test] + fn object_pool_case() { + // https://github.com/rust-embedded/heapless/issues/411 + object_pool!(CamelCaseType: u128); + object_pool!(SCREAMING_SNAKE_CASE_TYPE: u128); + } }