Skip to content

Commit 94b129a

Browse files
committed
Cargo fmt
1 parent e98ec3d commit 94b129a

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

src/lib.rs

+9-15
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@ extern crate winapi;
4343
#[cfg(not(windows))]
4444
use std::process::{Command, Stdio};
4545

46-
use std::{
47-
ffi::OsStr,
48-
io,
49-
process::ExitStatus,
50-
thread
51-
};
46+
use std::{ffi::OsStr, io, process::ExitStatus, thread};
5247

5348
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
5449
pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> io::Result<ExitStatus> {
@@ -111,15 +106,12 @@ pub fn that<T: AsRef<OsStr> + Sized>(path: T) -> io::Result<ExitStatus> {
111106
}
112107

113108
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
114-
pub fn with<T:AsRef<OsStr>+Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
115-
Command::new(app.into())
116-
.arg(path.as_ref())
117-
.spawn()?
118-
.wait()
109+
pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
110+
Command::new(app.into()).arg(path.as_ref()).spawn()?.wait()
119111
}
120112

121113
#[cfg(target_os = "windows")]
122-
pub fn with<T:AsRef<OsStr>+Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
114+
pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
123115
use std::os::windows::ffi::OsStrExt;
124116
use std::os::windows::process::ExitStatusExt;
125117
use std::ptr;
@@ -130,7 +122,9 @@ pub fn with<T:AsRef<OsStr>+Sized>(path: T, app: impl Into<String>) -> io::Result
130122

131123
let path = windows::convert_path(path.as_ref())?;
132124
let operation: Vec<u16> = OsStr::new("open\0").encode_wide().collect();
133-
let app_name: Vec<u16> = OsStr::new(&format!("{}\0", app.into())).encode_wide().collect();
125+
let app_name: Vec<u16> = OsStr::new(&format!("{}\0", app.into()))
126+
.encode_wide()
127+
.collect();
134128
let result = unsafe {
135129
ShellExecuteW(
136130
ptr::null_mut(),
@@ -149,7 +143,7 @@ pub fn with<T:AsRef<OsStr>+Sized>(path: T, app: impl Into<String>) -> io::Result
149143
}
150144

151145
#[cfg(target_os = "macos")]
152-
pub fn with<T:AsRef<OsStr>+Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
146+
pub fn with<T: AsRef<OsStr> + Sized>(path: T, app: impl Into<String>) -> io::Result<ExitStatus> {
153147
Command::new("open")
154148
.arg(path.as_ref())
155149
.arg("-a")
@@ -169,7 +163,7 @@ pub fn that_in_background<T: AsRef<OsStr> + Sized>(
169163

170164
pub fn with_in_background<T: AsRef<OsStr> + Sized>(
171165
path: T,
172-
app: impl Into<String>
166+
app: impl Into<String>,
173167
) -> thread::JoinHandle<io::Result<ExitStatus>> {
174168
let path = path.as_ref().to_os_string();
175169
let app = app.into();

src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ extern crate open;
33
use std::{
44
env,
55
io::{stderr, Write},
6-
process
6+
process,
77
};
88

99
fn main() {

0 commit comments

Comments
 (0)