diff options
Diffstat (limited to 'tools/hyper_hello.rs')
-rw-r--r-- | tools/hyper_hello.rs | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tools/hyper_hello.rs b/tools/hyper_hello.rs index d46ba3e14..7a24ea735 100644 --- a/tools/hyper_hello.rs +++ b/tools/hyper_hello.rs @@ -4,10 +4,10 @@ #![deny(warnings)] extern crate hyper; -use std::env; -use hyper::{Body, Response, Server}; -use hyper::service::service_fn_ok; use hyper::rt::{self, Future}; +use hyper::service::service_fn_ok; +use hyper::{Body, Response, Server}; +use std::env; static PHRASE: &'static [u8] = b"Hello World!"; @@ -22,17 +22,15 @@ fn main() { // new_service is run for each connection, creating a 'service' // to handle requests for that specific connection. let new_service = || { - // This is the `Service` that will handle the connection. - // `service_fn_ok` is a helper to convert a function that - // returns a Response into a `Service`. - service_fn_ok(|_| { - Response::new(Body::from(PHRASE)) - }) + // This is the `Service` that will handle the connection. + // `service_fn_ok` is a helper to convert a function that + // returns a Response into a `Service`. + service_fn_ok(|_| Response::new(Body::from(PHRASE))) }; let server = Server::bind(&addr) - .serve(new_service) - .map_err(|e| eprintln!("server error: {}", e)); + .serve(new_service) + .map_err(|e| eprintln!("server error: {}", e)); println!("Listening on http://{}", addr); |