1
1
use bytes:: Bytes ;
2
2
use sib:: network:: http:: {
3
3
h1:: { H1Service , H1ServiceFactory } ,
4
- message :: Status ,
4
+ util :: Status ,
5
5
session:: Session ,
6
6
} ;
7
7
use std:: {
@@ -63,7 +63,7 @@ impl H1ServiceFactory for H1Server<HService> {
63
63
fn main ( ) {
64
64
// Print number of CPU cores
65
65
let cpus = num_cpus:: get ( ) ;
66
- println ! ( "CPU cores: {}" , cpus ) ;
66
+ println ! ( "CPU cores: {cpus}" ) ;
67
67
68
68
// Print total RAM in MB
69
69
if let Ok ( meminfo) = fs:: read_to_string ( "/proc/meminfo" ) {
@@ -73,7 +73,7 @@ fn main() {
73
73
if parts. len ( ) >= 2 {
74
74
if let Ok ( kb) = parts[ 1 ] . parse :: < u64 > ( ) {
75
75
let mb = kb / 1024 ;
76
- println ! ( "Total RAM: {} MB" , mb ) ;
76
+ println ! ( "Total RAM: {mb } MB" ) ;
77
77
}
78
78
}
79
79
break ;
@@ -88,12 +88,12 @@ fn main() {
88
88
for _ in 0 ..cpus {
89
89
let handle = std:: thread:: spawn ( move || {
90
90
let id = std:: thread:: current ( ) . id ( ) ;
91
- println ! ( "Listening {} on thread: {:?}" , addr , id ) ;
91
+ println ! ( "Listening {addr } on thread: {id :?}" ) ;
92
92
H1Server ( HService )
93
- . start ( addr, cpus, 0 , None )
94
- . expect ( & format ! ( "h1 server failed to start for thread {:?}" , id ) )
93
+ . start ( addr, cpus, 0 )
94
+ . unwrap_or_else ( |_| panic ! ( "h1 server failed to start for thread {id :?}" ) )
95
95
. join ( )
96
- . expect ( & format ! ( "h1 server failed to joining thread {:?}" , id ) ) ;
96
+ . unwrap_or_else ( |_| panic ! ( "h1 server failed to joining thread {id :?}" ) ) ;
97
97
} ) ;
98
98
threads. push ( handle) ;
99
99
}
0 commit comments