Remove superfluous Clone bound on Entry methods.
Thanks to @Kimundi for pointing this out. I presume (without checking) that they got added along with the CloneAny stuff by accident. Closes #26.
This commit is contained in:
parent
8e413e2065
commit
839a6bc6e8
13
src/lib.rs
13
src/lib.rs
|
@ -233,7 +233,7 @@ pub enum Entry<'a, A: ?Sized + UncheckedAnyExt, V: 'a> {
|
|||
Vacant(VacantEntry<'a, A, V>),
|
||||
}
|
||||
|
||||
impl<'a, A: ?Sized + UncheckedAnyExt, V: IntoBox<A> + Clone> Entry<'a, A, V> {
|
||||
impl<'a, A: ?Sized + UncheckedAnyExt, V: IntoBox<A>> Entry<'a, A, V> {
|
||||
/// Ensures a value is in the entry by inserting the default if empty, and returns
|
||||
/// a mutable reference to the value in the entry.
|
||||
pub fn or_insert(self, default: V) -> &'a mut V {
|
||||
|
@ -337,9 +337,11 @@ mod tests {
|
|||
#[derive(Clone, Debug, PartialEq)] struct F(i32);
|
||||
#[derive(Clone, Debug, PartialEq)] struct J(i32);
|
||||
|
||||
macro_rules! test_entry {
|
||||
($name:ident, $init:ty) => {
|
||||
#[test]
|
||||
fn test_entry() {
|
||||
let mut map: AnyMap = AnyMap::new();
|
||||
fn $name() {
|
||||
let mut map = <$init>::new();
|
||||
assert_eq!(map.insert(A(10)), None);
|
||||
assert_eq!(map.insert(B(20)), None);
|
||||
assert_eq!(map.insert(C(30)), None);
|
||||
|
@ -403,6 +405,11 @@ mod tests {
|
|||
assert_eq!(map.get::<C>().unwrap(), &C(301));
|
||||
assert_eq!(map.len(), 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test_entry!(test_entry_any, AnyMap);
|
||||
test_entry!(test_entry_cloneany, Map<CloneAny>);
|
||||
|
||||
#[test]
|
||||
fn test_clone() {
|
||||
|
|
Loading…
Reference in a new issue