diff --git a/src/lib.rs b/src/lib.rs index f4c9cf0..d1fb91c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -42,7 +42,7 @@ use std::process::{Command, ExitStatus}; use std::ffi::OsStr; #[cfg(not(any(target_os = "windows", target_os = "macos")))] -pub fn that+Sized>(path: T) -> io::Result { +pub fn that + Sized>(path: T) -> io::Result { let mut last_err: io::Result = Err(io::Error::from_raw_os_error(0)); for program in &["xdg-open", "gnome-open", "kde-open"] { match Command::new(program).arg(path.as_ref()).spawn() { @@ -50,14 +50,14 @@ pub fn that+Sized>(path: T) -> io::Result { Err(err) => { last_err = Err(err); continue; - }, + } } } last_err } #[cfg(target_os = "windows")] -pub fn that+Sized>(path: T) -> io::Result { +pub fn that + Sized>(path: T) -> io::Result { let mut cmd = Command::new("cmd"); cmd.arg("/C").arg("start").arg(""); if let Some(s) = path.as_ref().to_str() { @@ -69,6 +69,6 @@ pub fn that+Sized>(path: T) -> io::Result { } #[cfg(target_os = "macos")] -pub fn that+Sized>(path: T) -> io::Result { +pub fn that + Sized>(path: T) -> io::Result { try!(Command::new("open").arg(path.as_ref()).spawn()).wait() } diff --git a/src/main.rs b/src/main.rs index 5f822f8..5b32599 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,17 +5,21 @@ use std::env; use std::process; fn main() { - let path_or_url = - match env::args().skip(1).next() { - Some(arg) => arg, - None => { - writeln!(stderr(), "usage: open ").ok(); - process::exit(1); - } - }; + let path_or_url = match env::args().skip(1).next() { + Some(arg) => arg, + None => { + writeln!(stderr(), "usage: open ").ok(); + process::exit(1); + } + }; if let Err(err) = open::that(&path_or_url) { - writeln!(stderr(), "An error occourred when opening '{}': {}", path_or_url, err).ok(); + writeln!( + stderr(), + "An error occourred when opening '{}': {}", + path_or_url, + err + ).ok(); process::exit(3); } }