Skip to content

Commit c4dff96

Browse files
authored
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<T> = std::result::Result<T, Box<error::Error>>; | ^^^^^^^^^^^^ 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`
1 parent b7ac1bc commit c4dff96

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/error/multiple_error_types/boxing_errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use std::error;
1313
use std::fmt;
1414
1515
// Change the alias to `Box<error::Error>`.
16-
type Result<T> = std::result::Result<T, Box<error::Error>>;
16+
type Result<T> = std::result::Result<T, Box<dyn error::Error>>;
1717
1818
#[derive(Debug, Clone)]
1919
struct EmptyVec;
@@ -29,7 +29,7 @@ impl error::Error for EmptyVec {
2929
"invalid first item to double"
3030
}
3131
32-
fn cause(&self) -> Option<&error::Error> {
32+
fn cause(&self) -> Option<&(dyn error::Error)> {
3333
// Generic error, underlying cause isn't tracked.
3434
None
3535
}

0 commit comments

Comments
 (0)