File tree 1 file changed +8
-7
lines changed
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -18,25 +18,26 @@ use std::io::prelude::*;
18
18
use std:: net:: { TcpListener , TcpStream } ;
19
19
use std:: process;
20
20
use std:: sync:: mpsc:: channel;
21
+ use std:: time:: Duration ;
21
22
use std:: thread:: { self , Builder } ;
22
23
23
24
fn main ( ) {
24
25
// This test has a chance to time out, try to not let it time out
25
26
thread:: spawn ( move || -> ( ) {
26
- thread:: sleep_ms ( 30 * 1000 ) ;
27
+ thread:: sleep ( Duration :: from_secs ( 30 ) ) ;
27
28
process:: exit ( 1 ) ;
28
29
} ) ;
29
30
30
- let mut listener = TcpListener :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
31
+ let listener = TcpListener :: bind ( "127.0.0.1:0" ) . unwrap ( ) ;
31
32
let addr = listener. local_addr ( ) . unwrap ( ) ;
32
33
thread:: spawn ( move || -> ( ) {
33
34
loop {
34
35
let mut stream = match listener. accept ( ) {
35
36
Ok ( stream) => stream. 0 ,
36
- Err ( error ) => continue ,
37
+ Err ( _ ) => continue ,
37
38
} ;
38
- stream. read ( & mut [ 0 ] ) ;
39
- stream. write ( & [ 2 ] ) ;
39
+ let _ = stream. read ( & mut [ 0 ] ) ;
40
+ let _ = stream. write ( & [ 2 ] ) ;
40
41
}
41
42
} ) ;
42
43
@@ -47,8 +48,8 @@ fn main() {
47
48
let res = Builder :: new ( ) . stack_size ( 64 * 1024 ) . spawn ( move || {
48
49
match TcpStream :: connect ( addr) {
49
50
Ok ( mut stream) => {
50
- stream. write ( & [ 1 ] ) ;
51
- stream. read ( & mut [ 0 ] ) ;
51
+ let _ = stream. write ( & [ 1 ] ) ;
52
+ let _ = stream. read ( & mut [ 0 ] ) ;
52
53
} ,
53
54
Err ( ..) => { }
54
55
}
You can’t perform that action at this time.
0 commit comments