diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2023-11-22 00:02:04 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2023-11-22 13:17:01 +0000 |
| commit | c15adf6557a43b51bae72252b49c89635dbee325 (patch) | |
| tree | 6cde25d24e2f55f87deaaf859f871749d3258acb /library/std/src/sys | |
| parent | d7e1f1cc0813727b197e13a7672517da7ff42b44 (diff) | |
| download | rust-c15adf6557a43b51bae72252b49c89635dbee325.tar.gz rust-c15adf6557a43b51bae72252b49c89635dbee325.zip | |
manual_range_contains
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/windows/stdio.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs index 1765c221543..819a48266d9 100644 --- a/library/std/src/sys/windows/stdio.rs +++ b/library/std/src/sys/windows/stdio.rs @@ -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 matches!(first_code_unit_remaining, 0xDCEE..=0xDFFF) { // low surrogate // We just hope this works, and give up otherwise let _ = write_u16s(handle, &utf16[written..written + 1]); @@ -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 matches!(last_char, 0xD800..=0xDBFF) { // high surrogate *surrogate = last_char; amount -= 1; |
