Skip to content

Commit

Permalink
use io::Error::new_const() everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Count-Count committed Mar 24, 2021
1 parent 52713a4 commit fb1fa97
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions library/std/src/sys/windows/stdio.rs
Expand Up @@ -84,9 +84,9 @@ fn write(
if data[0] >> 6 != 0b10 {
incomplete_utf8.len = 0;
// not a continuation byte - reject
return Err(io::Error::new(
return Err(io::Error::new_const(
io::ErrorKind::InvalidData,
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
));
}
incomplete_utf8.bytes[incomplete_utf8.len as usize] = data[0];
Expand All @@ -106,9 +106,9 @@ fn write(
return Ok(1);
}
Err(_) => {
return Err(io::Error::new(
return Err(io::Error::new_const(
io::ErrorKind::InvalidData,
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
));
}
}
Expand All @@ -134,9 +134,9 @@ fn write(
incomplete_utf8.len = 1;
return Ok(1);
} else {
return Err(io::Error::new(
return Err(io::Error::new_const(
io::ErrorKind::InvalidData,
"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
&"Windows stdio in console mode does not support writing non-UTF-8 byte sequences",
));
}
}
Expand Down

0 comments on commit fb1fa97

Please sign in to comment.