Skip to content

Commit 98d0b71

Browse files
committed
Fixes from PR
Signed-off-by: Ayush Singh <[email protected]>
1 parent a9a5ef9 commit 98d0b71

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

library/std/src/sys/uefi/stdio.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ impl io::Read for Stdin {
4040
return Err(io::const_io_error!(io::ErrorKind::Interrupted, "Special Key Press"));
4141
}
4242

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"))?;
43+
let Some(Ok(ch)) = char::decode_utf16([inp]).next() else {
44+
return Err(const_io_error!(io::ErrorKind::InvalidInput, "Invalid Input"));
45+
};
46+
4847
if ch.len_utf8() > buf.len() {
4948
self.pending = Some(ch);
5049
return Ok(0);

0 commit comments

Comments
 (0)