Skip to content

Commit 4c897e3

Browse files
committed
Remove unnecessary impl std::error::Error
1 parent afa9d6c commit 4c897e3

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

src/error/multiple_error_types/define_error_type.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Rust allows us to define our own error types. In general, a "good" error type:
1616
* Composes well with other errors
1717

1818
```rust,editable
19-
use std::error;
2019
use std::fmt;
2120
2221
type Result<T> = std::result::Result<T, DoubleError>;
@@ -38,14 +37,6 @@ impl fmt::Display for DoubleError {
3837
}
3938
}
4039
41-
// This is important for other errors to wrap this one.
42-
impl error::Error for DoubleError {
43-
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
44-
// Generic error, underlying cause isn't tracked.
45-
None
46-
}
47-
}
48-
4940
fn double_first(vec: Vec<&str>) -> Result<i32> {
5041
vec.first()
5142
// Change the error to our new type.

0 commit comments

Comments
 (0)