Skip to content

Commit 9edfc84

Browse files
committed
Minor tweaks
1 parent f9a3476 commit 9edfc84

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/communicate.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ mod raw {
155155
// close stdin when done writing, so the child receives EOF
156156
self.stdin.take();
157157
// deallocate the input data, we don't need it any more
158-
self.input_data.clear();
159-
self.input_data.shrink_to_fit();
158+
self.input_data = Vec::new();
160159
}
161160
}
162161
if out_ready {

src/popen.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ mod os {
692692
let cmd_to_exec = config.executable.as_ref().unwrap_or(&argv[0]);
693693
let just_exec = posix::stage_exec(
694694
cmd_to_exec,
695-
&argv[..],
695+
&argv,
696696
child_env.as_deref(),
697697
)?;
698698
unsafe {
@@ -710,7 +710,7 @@ mod os {
710710
let result = Popen::do_exec(
711711
just_exec,
712712
child_ends,
713-
config.cwd.as_ref().map(|x| &x[..]),
713+
config.cwd.as_deref(),
714714
config.setuid,
715715
config.setgid,
716716
);
@@ -987,7 +987,7 @@ mod os {
987987
executable.as_ref().map(OsString::as_ref),
988988
&cmdline,
989989
&env_block,
990-
&config.cwd.as_ref().map(|os| &os[..]),
990+
&config.cwd.as_deref(),
991991
true,
992992
0,
993993
raw(&child_stdin),
@@ -1089,7 +1089,7 @@ mod os {
10891089
block
10901090
}
10911091

1092-
trait PopenOsImpl: super::PopenOs {
1092+
trait PopenOsImpl {
10931093
fn wait_handle(&mut self, timeout: Option<Duration>) -> io::Result<Option<ExitStatus>>;
10941094
}
10951095

@@ -1264,7 +1264,7 @@ fn get_standard_stream(which: StandardStream) -> io::Result<Rc<File>> {
12641264
#[derive(Debug)]
12651265
#[non_exhaustive]
12661266
pub enum PopenError {
1267-
/// The underlying error is io::Error.
1267+
/// An IO system call failed while executing the requested operation.
12681268
IoError(io::Error),
12691269
/// A logical error was made, e.g. invalid arguments detected at run-time.
12701270
LogicError(&'static str),
@@ -1285,7 +1285,7 @@ impl From<communicate::CommunicateError> for PopenError {
12851285
impl Error for PopenError {
12861286
fn source(&self) -> Option<&(dyn Error + 'static)> {
12871287
match *self {
1288-
PopenError::IoError(ref err) => Some(err as &dyn Error),
1288+
PopenError::IoError(ref err) => Some(err),
12891289
PopenError::LogicError(_msg) => None,
12901290
}
12911291
}

src/posix.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use std::ptr;
1111
use std::rc::Rc;
1212
use std::time::{Duration, Instant};
1313

14-
use libc;
1514
use libc::{c_char, c_int};
1615

1716
use crate::os_common::{ExitStatus, StandardStream};

0 commit comments

Comments
 (0)