summaryrefslogtreecommitdiffstats
path: root/examples/hello_world.rs
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2019-02-21 11:56:15 -0800
committerGitHub <noreply@github.com>2019-02-21 11:56:15 -0800
commit80162306e71c8561873a9c9496d65f2c1387d119 (patch)
tree83327ca8d9d1326d54e3c679e1fb4eb16775d4be /examples/hello_world.rs
parentab595d08253dd7ee0422144f8dafffa382700976 (diff)
chore: apply rustfmt to all crates (#917)
Diffstat (limited to 'examples/hello_world.rs')
-rw-r--r--examples/hello_world.rs27
1 files changed, 14 insertions, 13 deletions
diff --git a/examples/hello_world.rs b/examples/hello_world.rs
index a05a8f22..c8276269 100644
--- a/examples/hello_world.rs
+++ b/examples/hello_world.rs
@@ -25,20 +25,21 @@ pub fn main() -> Result<(), Box<std::error::Error>> {
// Open a TCP stream to the socket address.
//
// Note that this is the Tokio TcpStream, which is fully async.
- let client = TcpStream::connect(&addr).and_then(|stream| {
- println!("created stream");
- io::write_all(stream, "hello world\n").then(|result| {
- println!("wrote to stream; success={:?}", result.is_ok());
- Ok(())
+ let client = TcpStream::connect(&addr)
+ .and_then(|stream| {
+ println!("created stream");
+ io::write_all(stream, "hello world\n").then(|result| {
+ println!("wrote to stream; success={:?}", result.is_ok());
+ Ok(())
+ })
})
- })
- .map_err(|err| {
- // All tasks must have an `Error` type of `()`. This forces error
- // handling and helps avoid silencing failures.
- //
- // In our example, we are only going to log the error to STDOUT.
- println!("connection error = {:?}", err);
- });
+ .map_err(|err| {
+ // All tasks must have an `Error` type of `()`. This forces error
+ // handling and helps avoid silencing failures.
+ //
+ // In our example, we are only going to log the error to STDOUT.
+ println!("connection error = {:?}", err);
+ });
// Start the Tokio runtime.
//