From 23b92192527975ef996439ccbbbcd9a5ce5600c1 Mon Sep 17 00:00:00 2001 From: Alex Martens Date: Wed, 22 Nov 2023 09:03:03 -0800 Subject: [PATCH] Add test for box_pool with different variable cases --- CHANGELOG.md | 1 + src/pool/boxed.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e9598f43f..ec5e63c2c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +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`. ## [v0.8.0] - 2023-11-07 diff --git a/src/pool/boxed.rs b/src/pool/boxed.rs index ceba53f30a..a14e49509f 100644 --- a/src/pool/boxed.rs +++ b/src/pool/boxed.rs @@ -95,12 +95,14 @@ use super::treiber::{NonNullPtr, Stack, UnionNode}; #[macro_export] macro_rules! box_pool { ($name:ident: $data_type:ty) => { + #[allow(non_camel_case_types)] pub struct $name; impl $crate::pool::boxed::BoxPool for $name { type Data = $data_type; fn singleton() -> &'static $crate::pool::boxed::BoxPoolImpl<$data_type> { + #[allow(non_upper_case_globals)] static $name: $crate::pool::boxed::BoxPoolImpl<$data_type> = $crate::pool::boxed::BoxPoolImpl::new(); @@ -555,4 +557,11 @@ mod tests { assert!(once.is_ok()); assert!(twice.is_ok()); } + + #[test] + fn box_pool_case() { + // https://github.com/rust-embedded/heapless/issues/411 + box_pool!(CamelCaseType: u128); + box_pool!(SCREAMING_SNAKE_CASE_TYPE: u128); + } }