We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e683933 commit 7294422Copy full SHA for 7294422
src/libstd/sys/redox/os.rs
@@ -144,10 +144,11 @@ pub fn env() -> Env {
144
let mut string = String::new();
145
if file.read_to_string(&mut string).is_ok() {
146
for line in string.lines() {
147
- if let Some(equal_sign) = line.chars().position(|c| c == '=') {
148
- let name = line.chars().take(equal_sign).collect::<String>();
149
- let value = line.chars().skip(equal_sign+1).collect::<String>();
150
- variables.push((OsString::from(name), OsString::from(value)));
+ let mut parts = line.splitn(2, '=');
+ if let Some(name) = parts.next() {
+ let value = parts.next().unwrap_or("");
+ variables.push((OsString::from(name.to_string()),
151
+ OsString::from(value.to_string())));
152
}
153
154
0 commit comments