Skip to content

Commit

Permalink
manual_range_contains
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Nov 22, 2023
1 parent d7e1f1c commit ff39844
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/std/src/sys/windows/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
// write the missing surrogate out now.
// Buffering it would mean we have to lie about the number of bytes written.
let first_code_unit_remaining = utf16[written];
if first_code_unit_remaining >= 0xDCEE && first_code_unit_remaining <= 0xDFFF {
if (0xDCEE..=0xDFFF).contains(&first_code_unit_remaining) {
// low surrogate
// We just hope this works, and give up otherwise
let _ = write_u16s(handle, &utf16[written..written + 1]);
Expand Down Expand Up @@ -332,7 +332,7 @@ fn read_u16s_fixup_surrogates(
// and it is not 0, so we know that `buf[amount - 1]` have been
// initialized.
let last_char = unsafe { buf[amount - 1].assume_init() };
if last_char >= 0xD800 && last_char <= 0xDBFF {
if (0xD800..=0xDBFF).contains(&last_char) {
// high surrogate
*surrogate = last_char;
amount -= 1;
Expand Down

0 comments on commit ff39844

Please sign in to comment.