@@ -12,7 +12,7 @@ macro_rules! unimpl {
12
12
( ) => {
13
13
return Err ( io:: const_error!(
14
14
io:: ErrorKind :: Unsupported ,
15
- & "This function is not yet implemented" ,
15
+ "This function is not yet implemented" ,
16
16
) ) ;
17
17
} ;
18
18
}
@@ -96,7 +96,7 @@ impl TcpStream {
96
96
0 ,
97
97
4096 ,
98
98
) else {
99
- return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Invalid response" ) ) ;
99
+ return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Invalid response" ) ) ;
100
100
} ;
101
101
102
102
// The first four bytes should be zero upon success, and will be nonzero
@@ -106,13 +106,13 @@ impl TcpStream {
106
106
// errcode is a u8 but stuck in a u16 where the upper byte is invalid. Mask & decode accordingly.
107
107
let errcode = response[ 0 ] ;
108
108
if errcode == NetError :: SocketInUse as u8 {
109
- return Err ( io:: const_error!( io:: ErrorKind :: ResourceBusy , & "Socket in use" , ) ) ;
109
+ return Err ( io:: const_error!( io:: ErrorKind :: ResourceBusy , "Socket in use" ) ) ;
110
110
} else if errcode == NetError :: Unaddressable as u8 {
111
- return Err ( io:: const_error!( io:: ErrorKind :: AddrNotAvailable , & "Invalid address" , ) ) ;
111
+ return Err ( io:: const_error!( io:: ErrorKind :: AddrNotAvailable , "Invalid address" ) ) ;
112
112
} else {
113
113
return Err ( io:: const_error!(
114
114
io:: ErrorKind :: InvalidInput ,
115
- & "Unable to connect or internal error" ,
115
+ "Unable to connect or internal error" ,
116
116
) ) ;
117
117
}
118
118
}
@@ -198,7 +198,7 @@ impl TcpStream {
198
198
) else {
199
199
return Err ( io:: const_error!(
200
200
io:: ErrorKind :: InvalidInput ,
201
- & "Library failure: wrong message type or messaging error"
201
+ "Library failure: wrong message type or messaging error" ,
202
202
) ) ;
203
203
} ;
204
204
@@ -212,14 +212,14 @@ impl TcpStream {
212
212
if result[ 0 ] != 0 {
213
213
if result[ 1 ] == 8 {
214
214
// timed out
215
- return Err ( io:: const_error!( io:: ErrorKind :: TimedOut , & "Timeout" , ) ) ;
215
+ return Err ( io:: const_error!( io:: ErrorKind :: TimedOut , "Timeout" ) ) ;
216
216
}
217
217
if result[ 1 ] == 9 {
218
218
// would block
219
- return Err ( io:: const_error!( io:: ErrorKind :: WouldBlock , & "Would block" , ) ) ;
219
+ return Err ( io:: const_error!( io:: ErrorKind :: WouldBlock , "Would block" ) ) ;
220
220
}
221
221
}
222
- Err ( io:: const_error!( io:: ErrorKind :: Other , & "recv_slice failure" ) )
222
+ Err ( io:: const_error!( io:: ErrorKind :: Other , "recv_slice failure" ) )
223
223
}
224
224
}
225
225
@@ -258,20 +258,20 @@ impl TcpStream {
258
258
self . write_timeout . load ( Ordering :: Relaxed ) as usize ,
259
259
buf_len,
260
260
)
261
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Internal error" ) ) ) ?;
261
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Internal error" ) ) ) ?;
262
262
263
263
if send_request. raw [ 0 ] != 0 {
264
264
if send_request. raw [ 4 ] == 8 {
265
265
// timed out
266
266
return Err ( io:: const_error!(
267
267
io:: ErrorKind :: BrokenPipe ,
268
- & "Timeout or connection closed" ,
268
+ "Timeout or connection closed" ,
269
269
) ) ;
270
270
} else if send_request. raw [ 4 ] == 9 {
271
271
// would block
272
- return Err ( io:: const_error!( io:: ErrorKind :: WouldBlock , & "Would block" , ) ) ;
272
+ return Err ( io:: const_error!( io:: ErrorKind :: WouldBlock , "Would block" ) ) ;
273
273
} else {
274
- return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Error when sending" , ) ) ;
274
+ return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Error when sending" ) ) ;
275
275
}
276
276
}
277
277
Ok ( u32:: from_le_bytes ( [
@@ -304,7 +304,7 @@ impl TcpStream {
304
304
0 ,
305
305
0 ,
306
306
) else {
307
- return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Internal error" ) ) ;
307
+ return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Internal error" ) ) ;
308
308
} ;
309
309
let mut i = get_addr. raw . iter ( ) ;
310
310
match * i. next ( ) . unwrap ( ) {
@@ -324,7 +324,7 @@ impl TcpStream {
324
324
}
325
325
Ok ( SocketAddr :: V6 ( SocketAddrV6 :: new ( new_addr. into ( ) , self . local_port , 0 , 0 ) ) )
326
326
}
327
- _ => Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Internal error" ) ) ,
327
+ _ => Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Internal error" ) ) ,
328
328
}
329
329
}
330
330
@@ -333,7 +333,7 @@ impl TcpStream {
333
333
services:: net_server ( ) ,
334
334
services:: NetBlockingScalar :: StdTcpStreamShutdown ( self . fd , how) . into ( ) ,
335
335
)
336
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Unexpected return value" ) ) )
336
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Unexpected return value" ) ) )
337
337
. map ( |_| ( ) )
338
338
}
339
339
@@ -355,7 +355,7 @@ impl TcpStream {
355
355
services:: net_server ( ) ,
356
356
services:: NetBlockingScalar :: StdSetNodelay ( self . fd , enabled) . into ( ) ,
357
357
)
358
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Unexpected return value" ) ) )
358
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Unexpected return value" ) ) )
359
359
. map ( |_| ( ) )
360
360
}
361
361
@@ -364,19 +364,19 @@ impl TcpStream {
364
364
services:: net_server ( ) ,
365
365
services:: NetBlockingScalar :: StdGetNodelay ( self . fd ) . into ( ) ,
366
366
)
367
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Unexpected return value" ) ) )
367
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Unexpected return value" ) ) )
368
368
. map ( |res| res[ 0 ] != 0 ) ?)
369
369
}
370
370
371
371
pub fn set_ttl ( & self , ttl : u32 ) -> io:: Result < ( ) > {
372
372
if ttl > 255 {
373
- return Err ( io:: Error :: new ( io:: ErrorKind :: InvalidInput , "TTL must be less than 256" ) ) ;
373
+ return Err ( io:: const_error! ( io:: ErrorKind :: InvalidInput , "TTL must be less than 256" ) ) ;
374
374
}
375
375
crate :: os:: xous:: ffi:: blocking_scalar (
376
376
services:: net_server ( ) ,
377
377
services:: NetBlockingScalar :: StdSetTtlTcp ( self . fd , ttl) . into ( ) ,
378
378
)
379
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Unexpected return value" ) ) )
379
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Unexpected return value" ) ) )
380
380
. map ( |_| ( ) )
381
381
}
382
382
@@ -385,7 +385,7 @@ impl TcpStream {
385
385
services:: net_server ( ) ,
386
386
services:: NetBlockingScalar :: StdGetTtlTcp ( self . fd ) . into ( ) ,
387
387
)
388
- . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , & "Unexpected return value" ) ) )
388
+ . or ( Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "Unexpected return value" ) ) )
389
389
. map ( |res| res[ 0 ] as _ ) ?)
390
390
}
391
391
0 commit comments