We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1e2a5aa commit 9871d55Copy full SHA for 9871d55
src/error.rs
@@ -43,10 +43,8 @@ impl fmt::Display for Error {
43
impl From<io::Error> for Error {
44
fn from(err: io::Error) -> Self {
45
err.raw_os_error()
46
- .map(|code| Error(unsafe {
47
- // all supported targets use 0 as success code
48
- NonZeroU32::new_unchecked(code as u32)
49
- }))
+ .and_then(|code| NonZeroU32::new(code as u32))
+ .map(|code| Error(code))
50
// in practice this should never happen
51
.unwrap_or(UNKNOWN_ERROR)
52
}
0 commit comments