In this snippet from Hyper\'s example, there\'s a bit of code that I\'ve annotated with types that compiles successfully:
.map_err(|x: std::io::Error| -> hype
Type information in Rust can flow backwards.
The return type of the closure is specified to be hyper::Error
. Therefore, the result of the block must be hyper::Error
, therefore the result of From::from
must be hyper::Error
.
If you wanted to, you could use ...
::::from(x)
... which would be the even more fully qualified version. But with the closure return type there, it's unnecessary.