@@ -1798,7 +1798,7 @@ impl crate::Socket {
1798
1798
docsrs,
1799
1799
doc( cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) )
1800
1800
) ]
1801
- pub fn original_dst ( & self ) -> io:: Result < Option < SockAddr > > {
1801
+ pub fn original_dst ( & self ) -> io:: Result < SockAddr > {
1802
1802
// Safety: `getsockopt` initialises the `SockAddr` for us.
1803
1803
unsafe {
1804
1804
SockAddr :: try_init ( |storage, len| {
@@ -1811,13 +1811,7 @@ impl crate::Socket {
1811
1811
) )
1812
1812
} )
1813
1813
}
1814
- . map_or_else (
1815
- |e| match e. raw_os_error ( ) {
1816
- Some ( libc:: ENOENT ) => Ok ( None ) ,
1817
- _ => Err ( e) ,
1818
- } ,
1819
- |( _, addr) | Ok ( Some ( addr) ) ,
1820
- )
1814
+ . map ( |( _, addr) | addr)
1821
1815
}
1822
1816
1823
1817
/// Get the value for the `IP6T_SO_ORIGINAL_DST` option on this socket.
@@ -1829,7 +1823,7 @@ impl crate::Socket {
1829
1823
docsrs,
1830
1824
doc( cfg( all( feature = "all" , any( target_os = "android" , target_os = "linux" ) ) ) )
1831
1825
) ]
1832
- pub fn original_dst_ipv6 ( & self ) -> io:: Result < Option < SockAddr > > {
1826
+ pub fn original_dst_ipv6 ( & self ) -> io:: Result < SockAddr > {
1833
1827
// Safety: `getsockopt` initialises the `SockAddr` for us.
1834
1828
unsafe {
1835
1829
SockAddr :: try_init ( |storage, len| {
@@ -1842,13 +1836,7 @@ impl crate::Socket {
1842
1836
) )
1843
1837
} )
1844
1838
}
1845
- . map_or_else (
1846
- |e| match e. raw_os_error ( ) {
1847
- Some ( libc:: ENOENT ) => Ok ( None ) ,
1848
- _ => Err ( e) ,
1849
- } ,
1850
- |( _, addr) | Ok ( Some ( addr) ) ,
1851
- )
1839
+ . map ( |( _, addr) | addr)
1852
1840
}
1853
1841
1854
1842
/// Copies data between a `file` and this socket using the `sendfile(2)`
0 commit comments