Skip to content

Commit 1f97c8b

Browse files
committed
Inline single-use construction of OsProcess
1 parent 4458947 commit 1f97c8b

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/currentprocess/mod.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ pub enum Process {
3030

3131
impl Process {
3232
pub fn os() -> Self {
33-
Self::Os(OsProcess::new())
33+
Self::Os(OsProcess {
34+
stderr_is_a_tty: io::stderr().is_terminal(),
35+
stdout_is_a_tty: io::stdout().is_terminal(),
36+
})
3437
}
3538

3639
pub fn name(&self) -> Option<String> {
@@ -215,21 +218,6 @@ pub struct OsProcess {
215218
pub(self) stdout_is_a_tty: bool,
216219
}
217220

218-
impl OsProcess {
219-
pub fn new() -> Self {
220-
Self {
221-
stderr_is_a_tty: io::stderr().is_terminal(),
222-
stdout_is_a_tty: io::stdout().is_terminal(),
223-
}
224-
}
225-
}
226-
227-
impl Default for OsProcess {
228-
fn default() -> Self {
229-
Self::new()
230-
}
231-
}
232-
233221
// ------------ test process ----------------
234222
#[cfg(feature = "test")]
235223
#[derive(Clone, Debug, Default)]

0 commit comments

Comments
 (0)