From 1c5218c338cdf8855c523168792662f689cfa6ff Mon Sep 17 00:00:00 2001 From: Patrick Chieppe Date: Tue, 19 Nov 2019 12:21:20 +1100 Subject: [PATCH] Fix inconsistently used bare trait objects --- core/src/inventory.rs | 2 +- core/src/lib.rs | 2 +- traitcast/src/tests.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/inventory.rs b/core/src/inventory.rs index 51d989b..c709039 100644 --- a/core/src/inventory.rs +++ b/core/src/inventory.rs @@ -17,7 +17,7 @@ pub fn build_registry() -> Registry { /// This is instantiated once for each castable trait. It describes how a trait /// can insert itself into the global table. pub struct EntryBuilder { - pub insert: Box, + pub insert: Box, } impl EntryBuilder { diff --git a/core/src/lib.rs b/core/src/lib.rs index c90ca10..81878e4 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -137,7 +137,7 @@ impl CastIntoTrait { /// An entry in the table for a particular castable trait. Stores methods to /// cast into one particular struct that implements the trait. pub struct ImplEntry { - pub cast_box: fn(Box) -> Result, Box>, + pub cast_box: fn(Box) -> Result, Box>, pub cast_mut: fn(&mut dyn Any) -> Option<&mut DynTrait>, pub cast_ref: fn(&dyn Any) -> Option<&DynTrait>, pub tid: TypeId, diff --git a/traitcast/src/tests.rs b/traitcast/src/tests.rs index afd3891..25db3b3 100644 --- a/traitcast/src/tests.rs +++ b/traitcast/src/tests.rs @@ -65,8 +65,8 @@ use crate::Traitcast; #[test] fn test_traitcast() { - let mut x: Box = Box::new(A { x: 0 }); - let mut y: Box = Box::new(B { y: 1 }); + let mut x: Box = Box::new(A { x: 0 }); + let mut y: Box = Box::new(B { y: 1 }); { // Can cast from Any to Bar