We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a9a5ef9 commit 98d0b71Copy full SHA for 98d0b71
library/std/src/sys/uefi/stdio.rs
@@ -40,11 +40,10 @@ impl io::Read for Stdin {
40
return Err(io::const_io_error!(io::ErrorKind::Interrupted, "Special Key Press"));
41
}
42
43
- // The option unwrap is safe since iterator will have 1 element.
44
- let ch: char = char::decode_utf16([inp])
45
- .next()
46
- .unwrap()
47
- .map_err(|_| io::const_io_error!(io::ErrorKind::InvalidInput, "Invalid Input"))?;
+ let Some(Ok(ch)) = char::decode_utf16([inp]).next() else {
+ return Err(const_io_error!(io::ErrorKind::InvalidInput, "Invalid Input"));
+ };
+
48
if ch.len_utf8() > buf.len() {
49
self.pending = Some(ch);
50
return Ok(0);
0 commit comments