Skip to content

Commit 72a7f73

Browse files
sharnoffcamelid
andauthored
Apply suggestions from code review
Co-authored-by: Camelid <camelidcamel@gmail.com>
1 parent 1c36bb2 commit 72a7f73

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: library/core/src/any.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
//! # Smart pointers and `dyn Any`
1818
//!
1919
//! One piece of behavior to keep in mind when using `Any` as a trait object,
20-
//! especially with types like `Box<dyn Any>` or `Arc<dyn Any>` is that simply
20+
//! especially with types like `Box<dyn Any>` or `Arc<dyn Any>`, is that simply
2121
//! calling `.type_id()` on the value will produce the `TypeId` of the
22-
//! container, and not the underlying trait object. This can be avoided
22+
//! *container*, not the underlying trait object. This can be avoided by
2323
//! converting the smart pointer into a `&dyn Any` instead, which will return
24-
//! the object's type id. For example:
24+
//! the object's `TypeId`. For example:
25+
//!
2526
//! ```
2627
//! use std::any::{Any, TypeId};
2728
//!
@@ -32,7 +33,6 @@
3233
//! // ... than this:
3334
//! let boxed_id = boxed.type_id();
3435
//!
35-
//! // Both of these assertions pass
3636
//! assert_eq!(actual_id, TypeId::of::<i32>());
3737
//! assert_eq!(boxed_id, TypeId::of::<Box<dyn Any>>());
3838
//! ```

0 commit comments

Comments
 (0)