Skip to content

Commit a8f5d70

Browse files
committed
(fix) Add a missing blanket implementation of DebugAny.
1 parent 806ef63 commit a8f5d70

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/internals.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use std::fmt::Debug;
1111
///
1212
/// There is also an exported alias for this type of `TypeMap`, `DebugMap`.
1313
pub trait DebugAny: Any + Debug { }
14+
impl<T: Any + Debug> DebugAny for T { }
1415

1516
unsafe impl UnsafeAnyExt for DebugAny {}
1617
unsafe impl UnsafeAnyExt for DebugAny + Send {}

src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ mod internals;
272272

273273
#[cfg(test)]
274274
mod test {
275-
use super::{TypeMap, CloneMap, SendMap, Key};
275+
use super::{TypeMap, CloneMap, DebugMap, SendMap, Key};
276276
use super::Entry::{Occupied, Vacant};
277277

278278
#[derive(Debug, PartialEq)]
@@ -343,4 +343,10 @@ mod test {
343343
let cloned = map.clone();
344344
assert_eq!(map.get::<KeyType>(), cloned.get::<KeyType>());
345345
}
346+
347+
#[test] fn test_debugmap() {
348+
let mut map: DebugMap = TypeMap::custom();
349+
map.insert::<KeyType>(Value(10));
350+
assert!(map.contains::<KeyType>());
351+
}
346352
}

0 commit comments

Comments
 (0)