zsiciarz / 24daysofrust

Code examples accompanying my "24 days of Rust" article series.
https://zsiciarz.github.io/24daysofrust/
MIT License
370 stars 40 forks source link

day5 second exemple of basic request doesn't work as is #5

Closed francisl closed 8 years ago

francisl commented 8 years ago

The correction with get_content don't compile on 1.8 Mac OS X.

cargo build
   Compiling timebotr v0.1.0 (file:///private/var/test/timebotr)
src/main.rs:16:20: 16:64 error: the trait `core::fmt::Display` is not implemented for the type `core::result::Result<collections::string::String, hyper::error::Error>` [E0277]
src/main.rs:16     println!("{}", get_content("http://httpbin.org/status/200"));
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<std macros>:2:25: 2:56 note: in this expansion of format_args!
<std macros>:3:1: 3:54 note: in this expansion of print! (defined in <std macros>)
src/main.rs:16:5: 16:66 note: in this expansion of println! (defined in <std macros>)
src/main.rs:16:20: 16:64 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:16:20: 16:64 note: `core::result::Result<collections::string::String, hyper::error::Error>` cannot be formatted with the default formatter; try using `:?` instead if you are using a format string
src/main.rs:16:20: 16:64 note: required by `core::fmt::Display::fmt`
error: aborting due to previous error
Could not compile `timebotr`.