aboutsummaryrefslogtreecommitdiffstats
path: root/src/edit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/edit.rs')
-rw-r--r--src/edit.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/edit.rs b/src/edit.rs
index 8f4e534..aa8c7b1 100644
--- a/src/edit.rs
+++ b/src/edit.rs
@@ -53,7 +53,7 @@ pub fn edit(contents: &str, help: &str) -> Result<String> {
(editor, editor_args)
};
- let res = std::process::Command::new(&cmd).args(&args).status();
+ let res = std::process::Command::new(cmd).args(&args).status();
match res {
Ok(res) => {
if !res.success() {
@@ -81,8 +81,6 @@ pub fn edit(contents: &str, help: &str) -> Result<String> {
}
fn contains_shell_metacharacters(cmd: &std::ffi::OsStr) -> bool {
- match cmd.to_str() {
- Some(s) => s.contains(&[' ', '$', '\'', '"'][..]),
- None => false,
- }
+ cmd.to_str()
+ .map_or(false, |s| s.contains(&[' ', '$', '\'', '"'][..]))
}