File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -77,18 +77,16 @@ impl Error {
77
77
/// [1]: https://doc.rust-lang.org/std/io/struct.Error.html#method.raw_os_error
78
78
#[ inline]
79
79
pub fn raw_os_error ( self ) -> Option < i32 > {
80
- if self . 0 . get ( ) < Self :: INTERNAL_START {
81
- match ( ) {
82
- # [ cfg( target_os = "solid_asp3" ) ]
80
+ const _ : ( ) = assert ! ( i32 :: MAX . unsigned_abs ( ) == Error :: INTERNAL_START - 1 ) ;
81
+ i32 :: try_from ( self . 0 . get ( ) ) . ok ( ) . map ( |errno| {
82
+ if cfg ! ( target_os = "solid_asp3" ) {
83
83
// On SOLID, negate the error code again to obtain the original
84
84
// error code.
85
- ( ) => Some ( - ( self . 0 . get ( ) as i32 ) ) ,
86
- # [ cfg ( not ( target_os = "solid_asp3" ) ) ]
87
- ( ) => Some ( self . 0 . get ( ) as i32 ) ,
85
+ -errno
86
+ } else {
87
+ errno
88
88
}
89
- } else {
90
- None
91
- }
89
+ } )
92
90
}
93
91
94
92
/// Extract the bare error code.
You can’t perform that action at this time.
0 commit comments