Skip to content

Commit dc163b6

Browse files
committed
Fix clippy lints in arc_pool and object_pool
1 parent a09fe68 commit dc163b6

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1818
### Fixed
1919

2020
- Fixed clippy lints.
21-
- Fixed `box_pool!` emitting clippy lints for `CamelCase` and `SNAKE_CASE`.
21+
- Fixed `{arc,box,object}_pool!` emitting clippy lints for `CamelCase` and `SNAKE_CASE`.
2222

2323
## [v0.8.0] - 2023-11-07
2424

src/pool/arc.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,14 @@ use super::treiber::{NonNullPtr, Stack, UnionNode};
8383
#[macro_export]
8484
macro_rules! arc_pool {
8585
($name:ident: $data_type:ty) => {
86+
#[allow(non_camel_case_types)]
8687
pub struct $name;
8788

8889
impl $crate::pool::arc::ArcPool for $name {
8990
type Data = $data_type;
9091

9192
fn singleton() -> &'static $crate::pool::arc::ArcPoolImpl<$data_type> {
93+
#[allow(non_upper_case_globals)]
9294
static $name: $crate::pool::arc::ArcPoolImpl<$data_type> =
9395
$crate::pool::arc::ArcPoolImpl::new();
9496

@@ -523,4 +525,11 @@ mod tests {
523525
let raw = &*arc as *const Zst4096;
524526
assert_eq!(0, raw as usize % 4096);
525527
}
528+
529+
#[test]
530+
fn arc_pool_case() {
531+
// https://github.com/rust-embedded/heapless/issues/411
532+
arc_pool!(CamelCaseType: u128);
533+
arc_pool!(SCREAMING_SNAKE_CASE_TYPE: u128);
534+
}
526535
}

src/pool/object.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,14 @@ use super::treiber::{AtomicPtr, NonNullPtr, Stack, StructNode};
8282
#[macro_export]
8383
macro_rules! object_pool {
8484
($name:ident: $data_type:ty) => {
85+
#[allow(non_camel_case_types)]
8586
pub struct $name;
8687

8788
impl $crate::pool::object::ObjectPool for $name {
8889
type Data = $data_type;
8990

9091
fn singleton() -> &'static $crate::pool::object::ObjectPoolImpl<$data_type> {
92+
#[allow(non_upper_case_globals)]
9193
static $name: $crate::pool::object::ObjectPoolImpl<$data_type> =
9294
$crate::pool::object::ObjectPoolImpl::new();
9395

@@ -417,4 +419,11 @@ mod tests {
417419
let raw = &*object as *const Zst4096;
418420
assert_eq!(0, raw as usize % 4096);
419421
}
422+
423+
#[test]
424+
fn object_pool_case() {
425+
// https://github.com/rust-embedded/heapless/issues/411
426+
object_pool!(CamelCaseType: u128);
427+
object_pool!(SCREAMING_SNAKE_CASE_TYPE: u128);
428+
}
420429
}

0 commit comments

Comments
 (0)