@@ -1194,32 +1194,24 @@ impl<'a> Interface<'a> {
1194
1194
let mut neighbor_addr = None ;
1195
1195
let mut respond = |inner : & mut InterfaceInner , response : IpPacket | {
1196
1196
neighbor_addr = Some ( response. ip_repr ( ) . dst_addr ( ) ) ;
1197
- match device. transmit ( ) . ok_or ( Error :: Exhausted ) {
1198
- Ok ( _t) => {
1199
- #[ cfg( any(
1200
- feature = "proto-ipv4-fragmentation" ,
1201
- feature = "proto-sixlowpan-fragmentation"
1202
- ) ) ]
1203
- if let Err ( e) = inner. dispatch_ip ( _t, response, Some ( _out_packets) ) {
1204
- net_debug ! ( "failed to dispatch IP: {}" , e) ;
1205
- return Err ( e) ;
1206
- }
1197
+ let t = device. transmit ( ) . ok_or_else ( || {
1198
+ net_debug ! ( "failed to transmit IP: {}" , Error :: Exhausted ) ;
1199
+ Error :: Exhausted
1200
+ } ) ?;
1207
1201
1208
- #[ cfg( not( any(
1209
- feature = "proto-ipv4-fragmentation" ,
1210
- feature = "proto-sixlowpan-fragmentation"
1211
- ) ) ) ]
1212
- if let Err ( e) = inner. dispatch_ip ( _t, response, None ) {
1213
- net_debug ! ( "failed to dispatch IP: {}" , e) ;
1214
- return Err ( e) ;
1215
- }
1216
- emitted_any = true ;
1217
- }
1218
- Err ( e) => {
1219
- net_debug ! ( "failed to transmit IP: {}" , e) ;
1220
- return Err ( e) ;
1221
- }
1222
- }
1202
+ #[ cfg( any(
1203
+ feature = "proto-ipv4-fragmentation" ,
1204
+ feature = "proto-sixlowpan-fragmentation"
1205
+ ) ) ]
1206
+ inner. dispatch_ip ( t, response, Some ( _out_packets) ) ?;
1207
+
1208
+ #[ cfg( not( any(
1209
+ feature = "proto-ipv4-fragmentation" ,
1210
+ feature = "proto-sixlowpan-fragmentation"
1211
+ ) ) ) ]
1212
+ inner. dispatch_ip ( t, response, None ) ?;
1213
+
1214
+ emitted_any = true ;
1223
1215
1224
1216
Ok ( ( ) )
1225
1217
} ;
0 commit comments