Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 committed Apr 12, 2018
1 parent 3156cbc commit d8fa88d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions parity/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ pub enum Error {
}

impl From<std::io::Error> for Error {
fn from(err: std::io::Error) -> Self {
Error::ProcessError(err)
}
fn from(err: std::io::Error) -> Self {
Error::ProcessError(err)
}
}

impl From<std::ffi::NulError> for Error {
fn from(err: std::ffi::NulError) -> Self {
Error::FfiNull(err)
}
fn from(err: std::ffi::NulError) -> Self {
Error::FfiNull(err)
}
}

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match *self {
Error::ProcessError(ref e) => write!(f, "{}", e),
Error::FfiNull(ref e) => write!(f, "{}", e),
fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
match *self {
Error::ProcessError(ref e) => write!(f, "{}", e),
Error::FfiNull(ref e) => write!(f, "{}", e),
Error::WindowsShellExecute => write!(f, "WindowsShellExecute failed"),
}
}
}
}
}

#[cfg(windows)]
Expand All @@ -64,7 +64,7 @@ pub fn open(url: &str) -> Result<(), Error> {
ptr::null(),
ptr::null(),
Normal) as INT
};
};
// https://msdn.microsoft.com/en-us/library/windows/desktop/bb762153(v=vs.85).aspx
// `ShellExecute` returns a value greater than 32 on success
if h_instance > WINDOWS_SHELL_EXECUTE_SUCCESS { Ok(()) } else { Err(Error::WindowsShellExecute) }
Expand Down

0 comments on commit d8fa88d

Please sign in to comment.