Skip to content

Commit 454d7a1

Browse files
committed
adjust trait bound for with_clone::Any
I believe the [new] std::marker::[Reflect] trait made it necessary to specify a Reflect bound, but it's advised to use an Any bound instead. Adding this bound makes it compile. I ran the tests and got an error saying it couldn't determine the type of one of the expressions so I introduced a scope to bind the result of the expression and annotate its type. I also removed the `convert` feature that was no longer needed. [new]: rust-lang/rust#23712 [Reflect]: http://doc.rust-lang.org/std/marker/trait.Reflect.html
1 parent c6480a9 commit 454d7a1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! This crate provides the `AnyMap` type, a safe and convenient store for one value of each type.
22
3-
#![feature(core, std_misc, convert)]
3+
#![feature(core, std_misc)]
44
#![cfg_attr(test, feature(test))]
55
#![warn(missing_docs, unused_results)]
66

@@ -346,9 +346,13 @@ mod tests {
346346
*v = new_v;
347347
}
348348
}
349-
assert_eq!(map.get().unwrap(), &B(200));
350-
assert_eq!(map.len(), 6);
351349

350+
{
351+
let b: &B = map.get().unwrap();
352+
assert_eq!(b, &B(200));
353+
}
354+
355+
assert_eq!(map.len(), 6);
352356

353357
// Existing key (remove)
354358
match map.entry::<C>() {

src/with_clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl<T: 'static + Clone> CloneToAny for T {
1616
/// Pretty much just `std::any::Any + Clone`.
1717
pub trait Any: ::std::any::Any + CloneToAny { }
1818

19-
impl<T: 'static + Clone> Any for T { }
19+
impl<T: 'static + Clone + Any> Any for T { }
2020

2121
impl Clone for Box<Any> {
2222
fn clone(&self) -> Box<Any> {

0 commit comments

Comments
 (0)