File tree Expand file tree Collapse file tree 3 files changed +21
-22
lines changed Expand file tree Collapse file tree 3 files changed +21
-22
lines changed Original file line number Diff line number Diff line change @@ -611,20 +611,21 @@ impl hyper::server::Service for ApiServerHttpService {
611611 // logged at its point of origin and not log it again.
612612 let response = result. generate_response ( ) ;
613613 let status_code = response. status ( ) ;
614- if result. is_ok ( ) {
615- info ! (
616- "The {} was executed successfully. Status code: {}." ,
617- description, status_code
618- ) ;
619- } else {
620- // It is safe to `unwrap_err` because result was checked
621- // against not being ok.
622- error ! (
623- "Received Error on {}. Status code: {}. Message: {}" ,
624- description,
625- status_code,
626- result. unwrap_err( )
627- ) ;
614+ match result {
615+ Ok ( _) => {
616+ info ! (
617+ "The {} was executed successfully. Status code: {}." ,
618+ description, status_code
619+ ) ;
620+ }
621+ Err ( e) => {
622+ error ! (
623+ "Received Error on {}. Status code: {}. Message: {}" ,
624+ description,
625+ status_code,
626+ e
627+ ) ;
628+ }
628629 }
629630 response
630631 } )
Original file line number Diff line number Diff line change @@ -534,11 +534,10 @@ mod tests {
534534 let mut count: usize = 0 ;
535535 loop {
536536 let ( o, _) = write_next ( h, buf. as_mut ( ) ) ?;
537- if o . is_some ( ) {
537+ if let Some ( packet ) = o {
538538 count += 1 ;
539- let p = o. unwrap ( ) ;
540- assert_eq ! ( p. source_address( ) , h. local_addr) ;
541- assert_eq ! ( p. destination_address( ) , remote_addr) ;
539+ assert_eq ! ( packet. source_address( ) , h. local_addr) ;
540+ assert_eq ! ( packet. destination_address( ) , remote_addr) ;
542541 } else {
543542 break ;
544543 }
Original file line number Diff line number Diff line change @@ -2036,10 +2036,9 @@ mod tests {
20362036 fn default_kernel_config ( & mut self , cust_kernel_path : Option < PathBuf > ) {
20372037 let kernel_temp_file =
20382038 NamedTempFile :: new ( ) . expect ( "Failed to create temporary kernel file." ) ;
2039- let kernel_path = if cust_kernel_path. is_some ( ) {
2040- cust_kernel_path. unwrap ( )
2041- } else {
2042- kernel_temp_file. path ( ) . to_path_buf ( )
2039+ let kernel_path = match cust_kernel_path {
2040+ Some ( kernel_path) => kernel_path,
2041+ None => kernel_temp_file. path ( ) . to_path_buf ( ) ,
20432042 } ;
20442043 let kernel_file = File :: open ( kernel_path) . expect ( "Cannot open kernel file" ) ;
20452044 let mut cmdline = kernel_cmdline:: Cmdline :: new ( arch:: CMDLINE_MAX_SIZE ) ;
You can’t perform that action at this time.
0 commit comments