Bug 1443853 - Avoid std::io::{Result,Error} renaming. r=jgraham
authorAndreas Tolfsen <ato@sny.no>
Wed, 07 Mar 2018 21:31:31 +0000
changeset 462562 83bb33caf3d352237970d0be2accad0c8378e59d
parent 462561 1730b54d8ebf0221c1c3c2f20ed8404c25c8bd9b
child 462563 2da49990b24780b797b7371ed9d54acc7641d20f
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgraham
bugs1443853
milestone60.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
Bug 1443853 - Avoid std::io::{Result,Error} renaming. r=jgraham We can pick up std::io::Result and std::io::Error directly from the std::io namespace without having to rename them. MozReview-Commit-ID: 9Xz92HvcFpO
testing/mozbase/rust/mozrunner/src/runner.rs
--- a/testing/mozbase/rust/mozrunner/src/runner.rs
+++ b/testing/mozbase/rust/mozrunner/src/runner.rs
@@ -1,17 +1,18 @@
 use mozprofile::prefreader::PrefReaderError;
 use mozprofile::profile::Profile;
 use std::collections::HashMap;
 use std::convert::From;
 use std::env;
 use std::error::Error;
 use std::ffi::{OsStr, OsString};
 use std::fmt;
-use std::io::{Error as IoError, ErrorKind, Result as IoResult};
+use std::io;
+use std::io::ErrorKind;
 use std::path::{Path, PathBuf};
 use std::process::{Child, Command, Stdio};
 use std::process;
 
 pub trait Runner {
     type Process;
 
     fn arg<'a, S>(&'a mut self, arg: S) -> &'a mut Self
@@ -41,29 +42,29 @@ pub trait Runner {
     fn stderr<'a, T>(&'a mut self, stderr: T) -> &'a mut Self
     where
         T: Into<Stdio>;
 
     fn start(self) -> Result<Self::Process, RunnerError>;
 }
 
 pub trait RunnerProcess {
-    fn status(&mut self) -> IoResult<Option<process::ExitStatus>>;
+    fn status(&mut self) -> io::Result<Option<process::ExitStatus>>;
 
     /// Determine if the process is still running.
     fn running(&mut self) -> bool;
 
     /// Forces the process to exit and returns the exit status.  This is
     /// equivalent to sending a SIGKILL on Unix platforms.
-    fn kill(&mut self) -> IoResult<process::ExitStatus>;
+    fn kill(&mut self) -> io::Result<process::ExitStatus>;
 }
 
 #[derive(Debug)]
 pub enum RunnerError {
-    Io(IoError),
+    Io(io::Error),
     PrefReader(PrefReaderError),
 }
 
 impl fmt::Display for RunnerError {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         self.description().fmt(f)
     }
 }
@@ -84,18 +85,18 @@ impl Error for RunnerError {
     fn cause(&self) -> Option<&Error> {
         Some(match *self {
             RunnerError::Io(ref err) => err as &Error,
             RunnerError::PrefReader(ref err) => err as &Error,
         })
     }
 }
 
-impl From<IoError> for RunnerError {
-    fn from(value: IoError) -> RunnerError {
+impl From<io::Error> for RunnerError {
+    fn from(value: io::Error) -> RunnerError {
         RunnerError::Io(value)
     }
 }
 
 impl From<PrefReaderError> for RunnerError {
     fn from(value: PrefReaderError) -> RunnerError {
         RunnerError::PrefReader(value)
     }
@@ -103,25 +104,25 @@ impl From<PrefReaderError> for RunnerErr
 
 #[derive(Debug)]
 pub struct FirefoxProcess {
     process: Child,
     profile: Profile,
 }
 
 impl RunnerProcess for FirefoxProcess {
-    fn status(&mut self) -> IoResult<Option<process::ExitStatus>> {
+    fn status(&mut self) -> io::Result<Option<process::ExitStatus>> {
         self.process.try_wait()
     }
 
     fn running(&mut self) -> bool {
         self.status().unwrap().is_none()
     }
 
-    fn kill(&mut self) -> IoResult<process::ExitStatus> {
+    fn kill(&mut self) -> io::Result<process::ExitStatus> {
         self.process.kill()?;
         self.process.wait()
     }
 }
 
 #[derive(Debug)]
 pub struct FirefoxRunner {
     binary: PathBuf,