11use std:: fs;
22use std:: path:: Path ;
3- use std:: time:: { Duration , Instant } ;
3+ use std:: time:: Duration ;
44
5- use futures:: future:: Future ;
5+ use futures:: future;
66use lsp_types:: { notification:: * , request:: * , * } ;
77use serde:: de:: Deserialize ;
88use serde_json:: json;
@@ -245,7 +245,8 @@ fn client_changing_workspace_lib_retains_diagnostics() {
245245
246246 let lib = rls. future_diagnostics ( "library/src/lib.rs" ) ;
247247 let bin = rls. future_diagnostics ( "binary/src/main.rs" ) ;
248- let ( lib, bin) = rls. block_on ( lib. join ( bin) ) . unwrap ( ) ;
248+ let ( lib, bin) = rls. block_on ( future:: join ( lib, bin) ) . unwrap ( ) ;
249+ let ( lib, bin) = ( lib. unwrap ( ) , bin. unwrap ( ) ) ;
249250
250251 assert ! ( lib. diagnostics. iter( ) . any( |m| m. message. contains( "unused variable: `test_val`" ) ) ) ;
251252 assert ! ( lib. diagnostics. iter( ) . any( |m| m. message. contains( "unused variable: `unused`" ) ) ) ;
@@ -268,7 +269,8 @@ fn client_changing_workspace_lib_retains_diagnostics() {
268269
269270 let lib = rls. future_diagnostics ( "library/src/lib.rs" ) ;
270271 let bin = rls. future_diagnostics ( "binary/src/main.rs" ) ;
271- let ( lib, bin) = rls. block_on ( lib. join ( bin) ) . unwrap ( ) ;
272+ let ( lib, bin) = rls. block_on ( future:: join ( lib, bin) ) . unwrap ( ) ;
273+ let ( lib, bin) = ( lib. unwrap ( ) , bin. unwrap ( ) ) ;
272274
273275 // lib unit tests have compile errors
274276 assert ! ( lib. diagnostics. iter( ) . any( |m| m. message. contains( "unused variable: `unused`" ) ) ) ;
@@ -293,7 +295,8 @@ fn client_changing_workspace_lib_retains_diagnostics() {
293295
294296 let lib = rls. future_diagnostics ( "library/src/lib.rs" ) ;
295297 let bin = rls. future_diagnostics ( "binary/src/main.rs" ) ;
296- let ( lib, bin) = rls. block_on ( lib. join ( bin) ) . unwrap ( ) ;
298+ let ( lib, bin) = rls. block_on ( future:: join ( lib, bin) ) . unwrap ( ) ;
299+ let ( lib, bin) = ( lib. unwrap ( ) , bin. unwrap ( ) ) ;
297300
298301 assert ! ( lib. diagnostics. iter( ) . any( |m| m. message. contains( "unused variable: `test_val`" ) ) ) ;
299302 assert ! ( lib. diagnostics. iter( ) . any( |m| m. message. contains( "unused variable: `unused`" ) ) ) ;
@@ -349,6 +352,7 @@ fn client_implicit_workspace_pick_up_lib_changes() {
349352
350353 let bin = rls. future_diagnostics ( "src/main.rs" ) ;
351354 let bin = rls. block_on ( bin) . unwrap ( ) ;
355+ let bin = bin. unwrap ( ) ;
352356 assert ! ( bin. diagnostics[ 0 ] . message. contains( "unused variable: `val`" ) ) ;
353357
354358 rls. notify :: < DidChangeTextDocument > ( DidChangeTextDocumentParams {
@@ -369,6 +373,7 @@ fn client_implicit_workspace_pick_up_lib_changes() {
369373 // bin depending on lib picks up type mismatch
370374 let bin = rls. future_diagnostics ( "src/main.rs" ) ;
371375 let bin = rls. block_on ( bin) . unwrap ( ) ;
376+ let bin = bin. unwrap ( ) ;
372377 assert ! ( bin. diagnostics[ 0 ] . message. contains( "cannot find function `foo`" ) ) ;
373378
374379 rls. notify :: < DidChangeTextDocument > ( DidChangeTextDocumentParams {
@@ -388,6 +393,7 @@ fn client_implicit_workspace_pick_up_lib_changes() {
388393
389394 let bin = rls. future_diagnostics ( "src/main.rs" ) ;
390395 let bin = rls. block_on ( bin) . unwrap ( ) ;
396+ let bin = bin. unwrap ( ) ;
391397 assert ! ( bin. diagnostics[ 0 ] . message. contains( "unused variable: `val`" ) ) ;
392398}
393399
@@ -1971,7 +1977,7 @@ fn client_omit_init_build() {
19711977 // We need to assert that no other messages are received after a short
19721978 // period of time (e.g. no build progress messages).
19731979 std:: thread:: sleep ( std:: time:: Duration :: from_secs ( 1 ) ) ;
1974- rls. block_on ( response) . unwrap ( ) ;
1980+ rls. block_on ( response) . unwrap ( ) . unwrap ( ) ;
19751981
19761982 assert_eq ! ( rls. messages( ) . iter( ) . count( ) , 1 ) ;
19771983}
@@ -2141,8 +2147,7 @@ fn client_fail_uninitialized_request() {
21412147 } ,
21422148 ) ;
21432149
2144- let delay = tokio_timer:: Delay :: new ( Instant :: now ( ) + Duration :: from_secs ( 1 ) ) ;
2145- rls. block_on ( delay) . unwrap ( ) ;
2150+ rls. block_on ( async { tokio:: time:: delay_for ( Duration :: from_secs ( 1 ) ) . await } ) . unwrap ( ) ;
21462151
21472152 let err = jsonrpc_core:: Failure :: deserialize ( rls. messages ( ) . last ( ) . unwrap ( ) ) . unwrap ( ) ;
21482153 assert_eq ! ( err. id, jsonrpc_core:: Id :: Num ( ID ) ) ;
0 commit comments