It was implemented on RawMap, and I’m not sure quite why it wasn’t
implemented on Map. I can’t think of any reason *not* to, though, so we
might as well.
Closes #30. Thanks to Maxwell Koo <mjkoo90@gmail.com> for the fix.
don’t signify). Technically a [breaking-change], but it was something for
development only, so I’m not in the slightest bit concerned by it.
+- Implement `Default` on `Map` (not just on `RawMap`)
+
I don’t plan for there to be any real changes from 0.12.1;
it should be just a bit of housecleaning and a version bump.
self.$field.clear()
}
}
+
+ impl<A: ?Sized + UncheckedAnyExt> Default for $t<A> {
+ #[inline]
+ fn default() -> $t<A> {
+ $t::new()
+ }
+ }
}
}
test_entry!(test_entry_any, AnyMap);
test_entry!(test_entry_cloneany, Map<CloneAny>);
+ #[test]
+ fn test_default() {
+ let map: AnyMap = Default::default();
+ assert_eq!(map.len(), 0);
+ }
+
#[test]
fn test_clone() {
let mut map: Map<CloneAny> = Map::new();
}
}
-impl<A: ?Sized + UncheckedAnyExt> Default for RawMap<A> {
- #[inline]
- fn default() -> RawMap<A> {
- RawMap::new()
- }
-}
-
impl_common_methods! {
field: RawMap.inner;
new() => HashMap::with_hasher(Default::default());