diff --git a/src/error/multiple_error_types/boxing_errors.md b/src/error/multiple_error_types/boxing_errors.md index ca506d4131..b2b4753f31 100644 --- a/src/error/multiple_error_types/boxing_errors.md +++ b/src/error/multiple_error_types/boxing_errors.md @@ -28,10 +28,10 @@ impl error::Error for EmptyVec {} fn double_first(vec: Vec<&str>) -> Result { vec.first() - .ok_or_else(|| EmptyVec.into()) // Converts to Box + .ok_or_else(|| EmptyVec.into()) // Converts to Box using Into trait. .and_then(|s| { s.parse::() - .map_err(|e| e.into()) // Converts to Box + .map_err(From::from) // Converts to Box using From::from fn pointer. .map(|i| 2 * i) }) }