Skip to content

Commit c15adf6

Browse files
committed
manual_range_contains
1 parent d7e1f1c commit c15adf6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: library/std/src/sys/windows/stdio.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result<usiz
207207
// write the missing surrogate out now.
208208
// Buffering it would mean we have to lie about the number of bytes written.
209209
let first_code_unit_remaining = utf16[written];
210-
if first_code_unit_remaining >= 0xDCEE && first_code_unit_remaining <= 0xDFFF {
210+
if matches!(first_code_unit_remaining, 0xDCEE..=0xDFFF) {
211211
// low surrogate
212212
// We just hope this works, and give up otherwise
213213
let _ = write_u16s(handle, &utf16[written..written + 1]);
@@ -332,7 +332,7 @@ fn read_u16s_fixup_surrogates(
332332
// and it is not 0, so we know that `buf[amount - 1]` have been
333333
// initialized.
334334
let last_char = unsafe { buf[amount - 1].assume_init() };
335-
if last_char >= 0xD800 && last_char <= 0xDBFF {
335+
if matches!(last_char, 0xD800..=0xDBFF) {
336336
// high surrogate
337337
*surrogate = last_char;
338338
amount -= 1;

0 commit comments

Comments
 (0)