File tree 2 files changed +3
-62
lines changed
2 files changed +3
-62
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ timestamp = ["chrono"]
26
26
27
27
[dependencies ]
28
28
chrono = { version = " 0.4" , optional = true }
29
- libc = { version = " 0.2.58" }
30
29
log = { version = " 0.4.8" , features = [" std" , " kv_unstable" ] }
31
30
log-panics = { version = " 2" , optional = true , features = [" with-backtrace" ] }
32
31
Original file line number Diff line number Diff line change @@ -406,65 +406,10 @@ fn log_failure(err: io::Error) {
406
406
// though the return type of the functions are different we only need them both
407
407
// to implement `io::Write`.
408
408
409
+ #[ cfg( test) ]
410
+ use self :: test_instruments:: { stderr, stdout, LOG_OUTPUT , LOG_OUTPUT_INDEX } ;
409
411
#[ cfg( not( test) ) ]
410
- struct Stdout ;
411
-
412
- #[ cfg( not( test) ) ]
413
- impl Write for Stdout {
414
- fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
415
- match unsafe {
416
- libc:: write (
417
- libc:: STDOUT_FILENO ,
418
- buf. as_ptr ( ) as * const libc:: c_void ,
419
- buf. len ( ) ,
420
- )
421
- } {
422
- n if n < 0 => Err ( io:: Error :: last_os_error ( ) ) ,
423
- n => Ok ( n as usize ) ,
424
- }
425
- }
426
-
427
- fn flush ( & mut self ) -> io:: Result < ( ) > {
428
- // Don't have to flush standard out.
429
- Ok ( ( ) )
430
- }
431
- }
432
-
433
- #[ cfg( not( test) ) ]
434
- #[ inline( always) ]
435
- fn stdout ( ) -> Stdout {
436
- Stdout
437
- }
438
-
439
- #[ cfg( not( test) ) ]
440
- struct Stderr ;
441
-
442
- #[ cfg( not( test) ) ]
443
- impl Write for Stderr {
444
- fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
445
- match unsafe {
446
- libc:: write (
447
- libc:: STDERR_FILENO ,
448
- buf. as_ptr ( ) as * const libc:: c_void ,
449
- buf. len ( ) ,
450
- )
451
- } {
452
- n if n < 0 => Err ( io:: Error :: last_os_error ( ) ) ,
453
- n => Ok ( n as usize ) ,
454
- }
455
- }
456
-
457
- fn flush ( & mut self ) -> io:: Result < ( ) > {
458
- // Don't have to flush standard error.
459
- Ok ( ( ) )
460
- }
461
- }
462
-
463
- #[ cfg( not( test) ) ]
464
- #[ inline( always) ]
465
- fn stderr ( ) -> Stderr {
466
- Stderr
467
- }
412
+ use std:: io:: { stderr, stdout} ;
468
413
469
414
// The testing variant of the functions.
470
415
@@ -536,6 +481,3 @@ mod test_instruments {
536
481
}
537
482
}
538
483
}
539
-
540
- #[ cfg( test) ]
541
- use self :: test_instruments:: { stderr, stdout, LOG_OUTPUT , LOG_OUTPUT_INDEX } ;
You can’t perform that action at this time.
0 commit comments