Skip to content

Commit

Permalink
ch8: wraperror2: remove map_err() call
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ewenmcneill committed Jan 10, 2023
1 parent 6ebd519 commit 4b9d766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ch8/misc/wraperror2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ impl From<net::AddrParseError> for UpstreamError {
}

fn main() -> Result<(), UpstreamError> {
let _f = File::open("invisible.txt").map_err(UpstreamError::IO)?;
let _localhost = "::1".parse::<Ipv6Addr>().map_err(UpstreamError::Parsing)?;
let _f = File::open("invisible.txt")?;
let _localhost = "::1".parse::<Ipv6Addr>()?;

Ok(())
}
}

0 comments on commit 4b9d766

Please sign in to comment.