From 7dd8317378fead5fe65d477d73cd358c30cb3354 Mon Sep 17 00:00:00 2001 From: Vinzent Steinberg Date: Mon, 3 Jun 2019 13:49:48 +0200 Subject: [PATCH] Fix deprecation warnings about dyn keyword --- rand_jitter/README.md | 2 +- src/distributions/other.rs | 2 +- src/distributions/weighted/mod.rs | 2 +- src/lib.rs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rand_jitter/README.md b/rand_jitter/README.md index c10c8f569cf..7c28834e591 100644 --- a/rand_jitter/README.md +++ b/rand_jitter/README.md @@ -56,7 +56,7 @@ fn get_nstime() -> u64 { dur.as_secs() << 30 | dur.subsec_nanos() as u64 } -fn main() -> Result<(), Box> { +fn main() -> Result<(), Box> { let mut rng = JitterRng::new_with_timer(get_nstime); // 1_000_000 results are required for the diff --git a/src/distributions/other.rs b/src/distributions/other.rs index 2295f790de1..84068a1c36d 100644 --- a/src/distributions/other.rs +++ b/src/distributions/other.rs @@ -182,7 +182,7 @@ mod tests { #[test] fn test_misc() { - let rng: &mut RngCore = &mut ::test::rng(820); + let rng: &mut dyn RngCore = &mut ::test::rng(820); rng.sample::(Standard); rng.sample::(Standard); diff --git a/src/distributions/weighted/mod.rs b/src/distributions/weighted/mod.rs index df388e70aab..6086e6f7873 100644 --- a/src/distributions/weighted/mod.rs +++ b/src/distributions/weighted/mod.rs @@ -225,7 +225,7 @@ impl ::std::error::Error for WeightedError { fn description(&self) -> &str { self.msg() } - fn cause(&self) -> Option<&::std::error::Error> { + fn cause(&self) -> Option<&dyn (::std::error::Error)> { None } } diff --git a/src/lib.rs b/src/lib.rs index 26d22473a75..8e4341699f0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -649,7 +649,7 @@ mod test { fn test_rng_trait_object() { use distributions::{Distribution, Standard}; let mut rng = rng(109); - let mut r = &mut rng as &mut RngCore; + let mut r = &mut rng as &mut dyn RngCore; r.next_u32(); r.gen::(); assert_eq!(r.gen_range(0, 1), 0); @@ -661,7 +661,7 @@ mod test { fn test_rng_boxed_trait() { use distributions::{Distribution, Standard}; let rng = rng(110); - let mut r = Box::new(rng) as Box; + let mut r = Box::new(rng) as Box; r.next_u32(); r.gen::(); assert_eq!(r.gen_range(0, 1), 0);