From 4b9d766f555d26af2a691fbe65e71196104febc0 Mon Sep 17 00:00:00 2001 From: Ewen McNeill Date: Tue, 10 Jan 2023 16:26:50 +1300 Subject: [PATCH] ch8: wraperror2: remove map_err() call To match the book text (Listing 8.15, which is supposed to match ch8/misc/wraperror2.rs, actually remove the map_err() calls that are not supposed to be needed once the std::convert::From trait is implemented for the wrapped types. --- ch8/misc/wraperror2.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ch8/misc/wraperror2.rs b/ch8/misc/wraperror2.rs index 645e5ca0..a5b9c273 100644 --- a/ch8/misc/wraperror2.rs +++ b/ch8/misc/wraperror2.rs @@ -29,8 +29,8 @@ impl From for UpstreamError { } fn main() -> Result<(), UpstreamError> { - let _f = File::open("invisible.txt").map_err(UpstreamError::IO)?; - let _localhost = "::1".parse::().map_err(UpstreamError::Parsing)?; + let _f = File::open("invisible.txt")?; + let _localhost = "::1".parse::()?; Ok(()) -} \ No newline at end of file +}