Skip to content

Commit 01959a0

Browse files
joshtriplettgitbot
authored and
gitbot
committed
Avoid naming variables str
This renames variables named `str` to other names, to make sure `str` always refers to a type. It's confusing to read code where `str` (or another standard type name) is used as an identifier. It also produces misleading syntax highlighting.
1 parent 50598e9 commit 01959a0

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

std/src/process.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1283,13 +1283,13 @@ impl fmt::Debug for Output {
12831283
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
12841284
let stdout_utf8 = str::from_utf8(&self.stdout);
12851285
let stdout_debug: &dyn fmt::Debug = match stdout_utf8 {
1286-
Ok(ref str) => str,
1286+
Ok(ref s) => s,
12871287
Err(_) => &self.stdout,
12881288
};
12891289

12901290
let stderr_utf8 = str::from_utf8(&self.stderr);
12911291
let stderr_debug: &dyn fmt::Debug = match stderr_utf8 {
1292-
Ok(ref str) => str,
1292+
Ok(ref s) => s,
12931293
Err(_) => &self.stderr,
12941294
};
12951295

std/src/sys/pal/windows/process.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ impl AsRef<OsStr> for EnvKey {
142142
}
143143
}
144144

145-
pub(crate) fn ensure_no_nuls<T: AsRef<OsStr>>(str: T) -> io::Result<T> {
146-
if str.as_ref().encode_wide().any(|b| b == 0) {
145+
pub(crate) fn ensure_no_nuls<T: AsRef<OsStr>>(s: T) -> io::Result<T> {
146+
if s.as_ref().encode_wide().any(|b| b == 0) {
147147
Err(io::const_error!(ErrorKind::InvalidInput, "nul byte found in provided data"))
148148
} else {
149-
Ok(str)
149+
Ok(s)
150150
}
151151
}
152152

std/src/sys_common/wtf8.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ impl Wtf8Buf {
204204
///
205205
/// Since WTF-8 is a superset of UTF-8, this always succeeds.
206206
#[inline]
207-
pub fn from_str(str: &str) -> Wtf8Buf {
208-
Wtf8Buf { bytes: <[_]>::to_vec(str.as_bytes()), is_known_utf8: true }
207+
pub fn from_str(s: &str) -> Wtf8Buf {
208+
Wtf8Buf { bytes: <[_]>::to_vec(s.as_bytes()), is_known_utf8: true }
209209
}
210210

211211
pub fn clear(&mut self) {

0 commit comments

Comments
 (0)