Skip to content

Commit 5f20b19

Browse files
committed
Rename OSProcess to OsProcess
1 parent c1c579f commit 5f20b19

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

src/process.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ pub mod terminalsource;
2424
/// Allows concrete types for the currentprocess abstraction.
2525
#[derive(Clone, Debug)]
2626
pub enum Process {
27-
OSProcess(OSProcess),
27+
OsProcess(OsProcess),
2828
#[cfg(feature = "test")]
2929
TestProcess(TestContext),
3030
}
3131

3232
impl Process {
3333
pub fn os() -> Self {
34-
Self::OSProcess(OSProcess::new())
34+
Self::OsProcess(OsProcess::new())
3535
}
3636

3737
pub fn name(&self) -> Option<String> {
@@ -61,7 +61,7 @@ impl Process {
6161

6262
pub fn var(&self, key: &str) -> Result<String, env::VarError> {
6363
match self {
64-
Process::OSProcess(_) => env::var(key),
64+
Process::OsProcess(_) => env::var(key),
6565
#[cfg(feature = "test")]
6666
Process::TestProcess(p) => match p.vars.get(key) {
6767
Some(val) => Ok(val.to_owned()),
@@ -72,55 +72,55 @@ impl Process {
7272

7373
pub(crate) fn var_os(&self, key: &str) -> Option<OsString> {
7474
match self {
75-
Process::OSProcess(_) => env::var_os(key),
75+
Process::OsProcess(_) => env::var_os(key),
7676
#[cfg(feature = "test")]
7777
Process::TestProcess(p) => p.vars.get(key).map(OsString::from),
7878
}
7979
}
8080

8181
pub(crate) fn args(&self) -> Box<dyn Iterator<Item = String> + '_> {
8282
match self {
83-
Process::OSProcess(_) => Box::new(env::args()),
83+
Process::OsProcess(_) => Box::new(env::args()),
8484
#[cfg(feature = "test")]
8585
Process::TestProcess(p) => Box::new(p.args.iter().cloned()),
8686
}
8787
}
8888

8989
pub(crate) fn args_os(&self) -> Box<dyn Iterator<Item = OsString> + '_> {
9090
match self {
91-
Process::OSProcess(_) => Box::new(env::args_os()),
91+
Process::OsProcess(_) => Box::new(env::args_os()),
9292
#[cfg(feature = "test")]
9393
Process::TestProcess(p) => Box::new(p.args.iter().map(OsString::from)),
9494
}
9595
}
9696

9797
pub(crate) fn stdin(&self) -> Box<dyn filesource::Stdin> {
9898
match self {
99-
Process::OSProcess(_) => Box::new(io::stdin()),
99+
Process::OsProcess(_) => Box::new(io::stdin()),
100100
#[cfg(feature = "test")]
101101
Process::TestProcess(p) => Box::new(filesource::TestStdin(p.stdin.clone())),
102102
}
103103
}
104104

105105
pub(crate) fn stdout(&self) -> Box<dyn filesource::Writer> {
106106
match self {
107-
Process::OSProcess(_) => Box::new(io::stdout()),
107+
Process::OsProcess(_) => Box::new(io::stdout()),
108108
#[cfg(feature = "test")]
109109
Process::TestProcess(p) => Box::new(filesource::TestWriter(p.stdout.clone())),
110110
}
111111
}
112112

113113
pub(crate) fn stderr(&self) -> Box<dyn filesource::Writer> {
114114
match self {
115-
Process::OSProcess(_) => Box::new(io::stderr()),
115+
Process::OsProcess(_) => Box::new(io::stderr()),
116116
#[cfg(feature = "test")]
117117
Process::TestProcess(p) => Box::new(filesource::TestWriter(p.stderr.clone())),
118118
}
119119
}
120120

121121
pub fn current_dir(&self) -> io::Result<PathBuf> {
122122
match self {
123-
Process::OSProcess(_) => env::current_dir(),
123+
Process::OsProcess(_) => env::current_dir(),
124124
#[cfg(feature = "test")]
125125
Process::TestProcess(p) => Ok(p.cwd.clone()),
126126
}
@@ -130,15 +130,15 @@ impl Process {
130130
impl home::env::Env for Process {
131131
fn home_dir(&self) -> Option<PathBuf> {
132132
match self {
133-
Process::OSProcess(_) => home::env::OS_ENV.home_dir(),
133+
Process::OsProcess(_) => home::env::OS_ENV.home_dir(),
134134
#[cfg(feature = "test")]
135135
Process::TestProcess(_) => self.var("HOME").ok().map(|v| v.into()),
136136
}
137137
}
138138

139139
fn current_dir(&self) -> Result<PathBuf, io::Error> {
140140
match self {
141-
Process::OSProcess(_) => home::env::OS_ENV.current_dir(),
141+
Process::OsProcess(_) => home::env::OS_ENV.current_dir(),
142142
#[cfg(feature = "test")]
143143
Process::TestProcess(_) => self.current_dir(),
144144
}
@@ -152,23 +152,23 @@ impl home::env::Env for Process {
152152
// ----------- real process -----------------
153153

154154
#[derive(Clone, Debug)]
155-
pub struct OSProcess {
155+
pub struct OsProcess {
156156
pub(self) stderr_is_a_tty: bool,
157157
pub(self) stdout_is_a_tty: bool,
158158
}
159159

160-
impl OSProcess {
160+
impl OsProcess {
161161
pub fn new() -> Self {
162-
OSProcess {
162+
OsProcess {
163163
stderr_is_a_tty: io::stderr().is_terminal(),
164164
stdout_is_a_tty: io::stdout().is_terminal(),
165165
}
166166
}
167167
}
168168

169-
impl Default for OSProcess {
169+
impl Default for OsProcess {
170170
fn default() -> Self {
171-
OSProcess::new()
171+
OsProcess::new()
172172
}
173173
}
174174

src/process/filesource.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl WriterLock for io::StdoutLock<'_> {}
4848
impl Writer for io::Stdout {
4949
fn is_a_tty(&self, process: &Process) -> bool {
5050
match process {
51-
crate::process::Process::OSProcess(p) => p.stdout_is_a_tty,
51+
crate::process::Process::OsProcess(p) => p.stdout_is_a_tty,
5252
#[cfg(feature = "test")]
5353
crate::process::Process::TestProcess(_) => unreachable!(),
5454
}
@@ -68,7 +68,7 @@ impl WriterLock for io::StderrLock<'_> {}
6868
impl Writer for io::Stderr {
6969
fn is_a_tty(&self, process: &Process) -> bool {
7070
match process {
71-
crate::process::Process::OSProcess(p) => p.stderr_is_a_tty,
71+
crate::process::Process::OsProcess(p) => p.stderr_is_a_tty,
7272
#[cfg(feature = "test")]
7373
crate::process::Process::TestProcess(_) => unreachable!(),
7474
}

src/process/terminalsource.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ impl StreamSelector {
2727
fn is_a_tty(&self, process: &Process) -> bool {
2828
match self {
2929
StreamSelector::Stdout => match process {
30-
Process::OSProcess(p) => p.stdout_is_a_tty,
30+
Process::OsProcess(p) => p.stdout_is_a_tty,
3131
#[cfg(feature = "test")]
3232
Process::TestProcess(_) => unreachable!(),
3333
},
3434
StreamSelector::Stderr => match process {
35-
Process::OSProcess(p) => p.stderr_is_a_tty,
35+
Process::OsProcess(p) => p.stderr_is_a_tty,
3636
#[cfg(feature = "test")]
3737
Process::TestProcess(_) => unreachable!(),
3838
},

0 commit comments

Comments
 (0)