Skip to content

Commit fb1fa97

Browse files
committed
use io::Error::new_const() everywhere
1 parent 52713a4 commit fb1fa97

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/std/src/sys/windows/stdio.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ fn write(
8484
if data[0] >> 6 != 0b10 {
8585
incomplete_utf8.len = 0;
8686
// not a continuation byte - reject
87-
return Err(io::Error::new(
87+
return Err(io::Error::new_const(
8888
io::ErrorKind::InvalidData,
89-
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
89+
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
9090
));
9191
}
9292
incomplete_utf8.bytes[incomplete_utf8.len as usize] = data[0];
@@ -106,9 +106,9 @@ fn write(
106106
return Ok(1);
107107
}
108108
Err(_) => {
109-
return Err(io::Error::new(
109+
return Err(io::Error::new_const(
110110
io::ErrorKind::InvalidData,
111-
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
111+
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
112112
));
113113
}
114114
}
@@ -134,9 +134,9 @@ fn write(
134134
incomplete_utf8.len = 1;
135135
return Ok(1);
136136
} else {
137-
return Err(io::Error::new(
137+
return Err(io::Error::new_const(
138138
io::ErrorKind::InvalidData,
139-
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
139+
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
140140
));
141141
}
142142
}

0 commit comments

Comments
 (0)