File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed
Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -385,15 +385,13 @@ pub async fn management(
385385 } ;
386386
387387 let user_agent = req. headers ( ) . get ( "User-Agent" ) ;
388- let device_type = user_agent
389- . and_then ( |h| h. to_str ( ) . ok ( ) )
390- . and_then ( |ua| {
391- if ua == "ESP32 HTTP Client/1.0" {
392- None
393- } else {
394- Some ( ua. to_string ( ) )
395- }
396- } ) ;
388+ let device_type = user_agent. and_then ( |h| h. to_str ( ) . ok ( ) ) . and_then ( |ua| {
389+ if ua == "ESP32 HTTP Client/1.0" {
390+ None
391+ } else {
392+ Some ( ua. to_string ( ) )
393+ }
394+ } ) ;
397395
398396 let mut conn = get_connection ( & state) ?;
399397 web_block_unpacked ( move || {
@@ -508,7 +506,10 @@ mod tests {
508506 . select ( DbCharger :: as_select ( ) )
509507 . get_result ( & mut conn)
510508 . unwrap ( ) ;
511- assert_eq ! ( db_charger. device_type. as_deref( ) , Some ( "Tinkerforge-WARP2_Charger/2.8.0+6811d0b1" ) ) ;
509+ assert_eq ! (
510+ db_charger. device_type. as_deref( ) ,
511+ Some ( "Tinkerforge-WARP2_Charger/2.8.0+6811d0b1" )
512+ ) ;
512513 }
513514
514515 #[ actix_web:: test]
Original file line number Diff line number Diff line change @@ -317,7 +317,10 @@ pub(crate) mod tests {
317317 assert ! ( resp. status( ) . is_success( ) ) ;
318318
319319 let body: UserInfo = test:: read_body_json ( resp) . await ;
320- assert ! ( !body. has_old_charger, "device_type present should prevent flag" ) ;
320+ assert ! (
321+ !body. has_old_charger,
322+ "device_type present should prevent flag"
323+ ) ;
321324 }
322325
323326 #[ actix_web:: test]
You can’t perform that action at this time.
0 commit comments