From c4dff961f0655d6ee3fffb29631433dc804f9eaa Mon Sep 17 00:00:00 2001 From: Adamas Date: Fri, 27 Dec 2019 10:00:01 +0800 Subject: [PATCH] eliminate the warnings if there is no `dyn`, there are warnings like this: warning: trait objects without an explicit `dyn` are deprecated --> xxx.rs:5:45 | 5 | type Result = std::result::Result>; | ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error` | = note: `#[warn(bare_trait_objects)]` on by default warning: trait objects without an explicit `dyn` are deprecated --> xxx.rs:21:32 | 21 | fn cause(&self) -> Option<&error::Error> { | ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error` --- src/error/multiple_error_types/boxing_errors.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/error/multiple_error_types/boxing_errors.md b/src/error/multiple_error_types/boxing_errors.md index e2eb68607e..b0fc2aa3ec 100644 --- a/src/error/multiple_error_types/boxing_errors.md +++ b/src/error/multiple_error_types/boxing_errors.md @@ -13,7 +13,7 @@ use std::error; use std::fmt; // Change the alias to `Box`. -type Result = std::result::Result>; +type Result = std::result::Result>; #[derive(Debug, Clone)] struct EmptyVec; @@ -29,7 +29,7 @@ impl error::Error for EmptyVec { "invalid first item to double" } - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&(dyn error::Error)> { // Generic error, underlying cause isn't tracked. None }