webdriver: Return early using try!() instead of unwrapping errors (#43)
authorAndreas Tolfsen <ato@mozilla.com>
Tue, 13 Sep 2016 16:58:07 +0100
changeset 428081 4596e710aa5fd87e859cac2b8cb38cb795c95a96
parent 428080 6824674691b0dba8749a940e028b3d4aa0c52895
child 428082 1b4d4044fe96f024ebf04a4886a959dfd1a2bb73
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
webdriver: Return early using try!() instead of unwrapping errors (#43) * server: return early using try!() instead of unwrapping errors Source-Repo: https://github.com/mozilla/webdriver-rust Source-Revision: 8d22698d409c62d74963a70461a886b7a16cdc1a committer: jgraham <james@hoppipolla.co.uk>
testing/webdriver/src/server.rs
--- a/testing/webdriver/src/server.rs
+++ b/testing/webdriver/src/server.rs
@@ -236,20 +236,19 @@ pub fn start<T, U>(address: SocketAddr,
                    -> Result<Listening>
     where T: 'static + WebDriverHandler<U>,
           U: 'static + WebDriverExtensionRoute
 {
     let (msg_send, msg_recv) = channel();
 
     let api = WebDriverHttpApi::new(extension_routes);
     let http_handler = HttpHandler::new(api, msg_send);
-    let mut server = Server::http(address).unwrap();
+    let mut server = try!(Server::http(address));
     server.keep_alive(None);
 
     let builder = thread::Builder::new().name("webdriver dispatcher".to_string());
-    builder.spawn(move || {
-            let mut dispatcher = Dispatcher::new(handler);
-            dispatcher.run(msg_recv);
-        })
-        .unwrap();
+    try!(builder.spawn(move || {
+        let mut dispatcher = Dispatcher::new(handler);
+        dispatcher.run(msg_recv);
+    }));
 
     server.handle(http_handler)
 }