From 94b129ad998729967a856f19f74e4628957ea99b Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 8 Mar 2020 14:21:34 +0800 Subject: [PATCH] Cargo fmt --- src/lib.rs | 24 +++++++++--------------- src/main.rs | 2 +- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 2e033b5..77fd175 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,12 +43,7 @@ extern crate winapi; #[cfg(not(windows))] use std::process::{Command, Stdio}; -use std::{ - ffi::OsStr, - io, - process::ExitStatus, - thread -}; +use std::{ffi::OsStr, io, process::ExitStatus, thread}; #[cfg(not(any(target_os = "windows", target_os = "macos")))] pub fn that + Sized>(path: T) -> io::Result { @@ -111,15 +106,12 @@ pub fn that + Sized>(path: T) -> io::Result { } #[cfg(not(any(target_os = "windows", target_os = "macos")))] -pub fn with+Sized>(path: T, app: impl Into) -> io::Result { - Command::new(app.into()) - .arg(path.as_ref()) - .spawn()? - .wait() +pub fn with + Sized>(path: T, app: impl Into) -> io::Result { + Command::new(app.into()).arg(path.as_ref()).spawn()?.wait() } #[cfg(target_os = "windows")] -pub fn with+Sized>(path: T, app: impl Into) -> io::Result { +pub fn with + Sized>(path: T, app: impl Into) -> io::Result { use std::os::windows::ffi::OsStrExt; use std::os::windows::process::ExitStatusExt; use std::ptr; @@ -130,7 +122,9 @@ pub fn with+Sized>(path: T, app: impl Into) -> io::Result let path = windows::convert_path(path.as_ref())?; let operation: Vec = OsStr::new("open\0").encode_wide().collect(); - let app_name: Vec = OsStr::new(&format!("{}\0", app.into())).encode_wide().collect(); + let app_name: Vec = OsStr::new(&format!("{}\0", app.into())) + .encode_wide() + .collect(); let result = unsafe { ShellExecuteW( ptr::null_mut(), @@ -149,7 +143,7 @@ pub fn with+Sized>(path: T, app: impl Into) -> io::Result } #[cfg(target_os = "macos")] -pub fn with+Sized>(path: T, app: impl Into) -> io::Result { +pub fn with + Sized>(path: T, app: impl Into) -> io::Result { Command::new("open") .arg(path.as_ref()) .arg("-a") @@ -169,7 +163,7 @@ pub fn that_in_background + Sized>( pub fn with_in_background + Sized>( path: T, - app: impl Into + app: impl Into, ) -> thread::JoinHandle> { let path = path.as_ref().to_os_string(); let app = app.into(); diff --git a/src/main.rs b/src/main.rs index 27a0461..f800ad1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ extern crate open; use std::{ env, io::{stderr, Write}, - process + process, }; fn main() {