Skip to content

Commit 4b9d766

Browse files
committed
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.
1 parent 6ebd519 commit 4b9d766

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ch8/misc/wraperror2.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ impl From<net::AddrParseError> for UpstreamError {
2929
}
3030

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

3535
Ok(())
36-
}
36+
}

0 commit comments

Comments
 (0)