@@ -261,8 +261,7 @@ impl TimeValLike for TimeSpec {
261
261
fn seconds ( seconds : i64 ) -> TimeSpec {
262
262
assert ! (
263
263
( TS_MIN_SECONDS ..=TS_MAX_SECONDS ) . contains( & seconds) ,
264
- "TimeSpec out of bounds; seconds={}" ,
265
- seconds
264
+ "TimeSpec out of bounds; seconds={seconds}" ,
266
265
) ;
267
266
let mut ts = zero_init_timespec ( ) ;
268
267
ts. tv_sec = seconds as time_t ;
@@ -428,20 +427,20 @@ impl fmt::Display for TimeSpec {
428
427
429
428
let sec = abs. tv_sec ( ) ;
430
429
431
- write ! ( f, "{}" , sign ) ?;
430
+ write ! ( f, "{sign}" ) ?;
432
431
433
432
if abs. tv_nsec ( ) == 0 {
434
- if abs . tv_sec ( ) == 1 {
435
- write ! ( f, "{} second" , sec ) ?;
433
+ if sec == 1 {
434
+ write ! ( f, "1 second" ) ?;
436
435
} else {
437
- write ! ( f, "{} seconds" , sec ) ?;
436
+ write ! ( f, "{sec } seconds" ) ?;
438
437
}
439
438
} else if abs. tv_nsec ( ) % 1_000_000 == 0 {
440
- write ! ( f, "{}.{:03} seconds" , sec , abs. tv_nsec( ) / 1_000_000 ) ?;
439
+ write ! ( f, "{sec }.{:03} seconds" , abs. tv_nsec( ) / 1_000_000 ) ?;
441
440
} else if abs. tv_nsec ( ) % 1_000 == 0 {
442
- write ! ( f, "{}.{:06} seconds" , sec , abs. tv_nsec( ) / 1_000 ) ?;
441
+ write ! ( f, "{sec }.{:06} seconds" , abs. tv_nsec( ) / 1_000 ) ?;
443
442
} else {
444
- write ! ( f, "{}.{:09} seconds" , sec , abs. tv_nsec( ) ) ?;
443
+ write ! ( f, "{sec }.{:09} seconds" , abs. tv_nsec( ) ) ?;
445
444
}
446
445
447
446
Ok ( ( ) )
@@ -497,8 +496,7 @@ impl TimeValLike for TimeVal {
497
496
fn seconds ( seconds : i64 ) -> TimeVal {
498
497
assert ! (
499
498
( TV_MIN_SECONDS ..=TV_MAX_SECONDS ) . contains( & seconds) ,
500
- "TimeVal out of bounds; seconds={}" ,
501
- seconds
499
+ "TimeVal out of bounds; seconds={seconds}"
502
500
) ;
503
501
#[ cfg_attr( target_env = "musl" , allow( deprecated) ) ]
504
502
// https://github.com/rust-lang/libc/issues/1848
@@ -662,18 +660,18 @@ impl fmt::Display for TimeVal {
662
660
663
661
let sec = abs. tv_sec ( ) ;
664
662
665
- write ! ( f, "{}" , sign ) ?;
663
+ write ! ( f, "{sign}" ) ?;
666
664
667
665
if abs. tv_usec ( ) == 0 {
668
- if abs . tv_sec ( ) == 1 {
669
- write ! ( f, "{} second" , sec ) ?;
666
+ if sec == 1 {
667
+ write ! ( f, "1 second" ) ?;
670
668
} else {
671
- write ! ( f, "{} seconds" , sec ) ?;
669
+ write ! ( f, "{sec } seconds" ) ?;
672
670
}
673
671
} else if abs. tv_usec ( ) % 1000 == 0 {
674
- write ! ( f, "{}.{:03} seconds" , sec , abs. tv_usec( ) / 1000 ) ?;
672
+ write ! ( f, "{sec }.{:03} seconds" , abs. tv_usec( ) / 1000 ) ?;
675
673
} else {
676
- write ! ( f, "{}.{:06} seconds" , sec , abs. tv_usec( ) ) ?;
674
+ write ! ( f, "{sec }.{:06} seconds" , abs. tv_usec( ) ) ?;
677
675
}
678
676
679
677
Ok ( ( ) )
0 commit comments