diff options
author | Liran Ringel <5730310+liranringel@users.noreply.github.com> | 2018-11-20 18:10:36 +0200 |
---|---|---|
committer | Toby Lawrence <tobz@users.noreply.github.com> | 2018-11-20 11:10:36 -0500 |
commit | 9b1a45cc6a15f5d2be17531dffc2f50d2b019646 (patch) | |
tree | da66c5c9574f2cd7ad11745e414fc34da2e35c6f /examples/hello_world.rs | |
parent | 477fa5580aa3796f97e3e0eb1325d4690b3b4e96 (diff) |
tests: handle errors properly in examples (#748)
Diffstat (limited to 'examples/hello_world.rs')
-rw-r--r-- | examples/hello_world.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/hello_world.rs b/examples/hello_world.rs index c94ec53c..a05a8f22 100644 --- a/examples/hello_world.rs +++ b/examples/hello_world.rs @@ -19,8 +19,8 @@ use tokio::io; use tokio::net::TcpStream; use tokio::prelude::*; -pub fn main() { - let addr = "127.0.0.1:6142".parse().unwrap(); +pub fn main() -> Result<(), Box<std::error::Error>> { + let addr = "127.0.0.1:6142".parse()?; // Open a TCP stream to the socket address. // @@ -52,4 +52,6 @@ pub fn main() { println!("About to create the stream and write to it..."); tokio::run(client); println!("Stream has been created and written to."); + + Ok(()) } |