Skip to content

Commit 5d24271

Browse files
committed
Revert command name in error type to &'static str
1 parent 9a36c6e commit 5d24271

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313
### Changed
1414
- On Linux (non-WSL), the system `xdg-open` is now used if present. Otherwise, the bundled version is used, as before.
1515
- Avoid blocking the thread on Linux and WSL.
16-
- The command name in the `OpenError::ExitStatus` variant is now returned as a `Cow<'static, str>` instead of a
17-
`&'static str`.
1816
### Removed
1917
- `impl From<io::Error> for OpenError`.
2018

opener/src/lib.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ use crate::macos as sys;
4040
#[cfg(target_os = "windows")]
4141
use crate::windows as sys;
4242

43-
use std::borrow::Cow;
4443
use std::error::Error;
4544
use std::ffi::{OsStr, OsString};
4645
use std::fmt::{self, Display, Formatter};
@@ -120,7 +119,7 @@ pub enum OpenError {
120119
/// A command exited with a non-zero exit status.
121120
ExitStatus {
122121
/// A string that identifies the command.
123-
cmd: Cow<'static, str>,
122+
cmd: &'static str,
124123

125124
/// The failed process's exit status.
126125
status: ExitStatus,
@@ -204,10 +203,7 @@ fn wsl_to_windows_path(_path: &OsStr) -> Option<OsString> {
204203
}
205204

206205
#[cfg(not(target_os = "windows"))]
207-
fn wait_child(
208-
child: &mut std::process::Child,
209-
cmd_name: Cow<'static, str>,
210-
) -> Result<(), OpenError> {
206+
fn wait_child(child: &mut std::process::Child, cmd_name: &'static str) -> Result<(), OpenError> {
211207
use std::io::Read;
212208

213209
let exit_status = child.wait().map_err(OpenError::Io)?;

opener/src/linux_and_more.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub(crate) fn open(path: &OsStr) -> Result<(), OpenError> {
1717
fn wsl_open(path: &OsStr) -> Result<(), OpenError> {
1818
let result = open_with_wslview(path);
1919
if let Ok(mut child) = result {
20-
return crate::wait_child(&mut child, "wslview".into());
20+
return crate::wait_child(&mut child, "wslview");
2121
}
2222

2323
open_with_system_xdg_open(path).map_err(OpenError::Io)?;

opener/src/macos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pub(crate) fn open(path: &OsStr) -> Result<(), OpenError> {
1111
.spawn()
1212
.map_err(OpenError::Io)?;
1313

14-
crate::wait_child(&mut open, "open".into())
14+
crate::wait_child(&mut open, "open")
1515
}

0 commit comments

Comments
 (0)