From 306ac19983240ff5216ef133959b4ae40e9148e7 Mon Sep 17 00:00:00 2001 From: Scott Mabin Date: Wed, 1 Nov 2023 14:00:16 +0000 Subject: [PATCH] fmt --- esp-wifi/examples/bench.rs | 24 +++++++++++++++--------- esp-wifi/examples/embassy_bench.rs | 15 +++------------ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/esp-wifi/examples/bench.rs b/esp-wifi/examples/bench.rs index 19cfc433..c0ee96d2 100644 --- a/esp-wifi/examples/bench.rs +++ b/esp-wifi/examples/bench.rs @@ -121,7 +121,7 @@ fn main() -> ! { let mut socket = wifi_stack.get_socket(&mut rx_buffer, &mut tx_buffer); let delay = hal::Delay::new(&clocks); - + loop { test_download(server_address, &mut socket); delay.delay(3_000_000); @@ -135,7 +135,10 @@ fn main() -> ! { } } -fn test_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>) { +fn test_download<'a>( + server_address: Ipv4Address, + socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>, +) { println!("Testing download..."); socket.work(); @@ -143,7 +146,6 @@ fn test_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_in .open(IpAddress::Ipv4(server_address), DOWNLOAD_PORT) .unwrap(); - let mut buf = [0; IO_BUFFER_SIZE]; let mut total = 0; @@ -167,7 +169,10 @@ fn test_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_in socket.disconnect(); } -fn test_upload<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>) { +fn test_upload<'a>( + server_address: Ipv4Address, + socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>, +) { println!("Testing upload..."); socket.work(); @@ -175,7 +180,6 @@ fn test_upload<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_inte .open(IpAddress::Ipv4(server_address), UPLOAD_PORT) .unwrap(); - let buf = [0; IO_BUFFER_SIZE]; let mut total = 0; @@ -199,7 +203,10 @@ fn test_upload<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_inte socket.disconnect(); } -fn test_upload_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>) { +fn test_upload_download<'a>( + server_address: Ipv4Address, + socket: &mut esp_wifi::wifi_interface::Socket<'a, 'a>, +) { println!("Testing upload+download..."); socket.work(); @@ -207,7 +214,6 @@ fn test_upload_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi:: .open(IpAddress::Ipv4(server_address), UPLOAD_DOWNLOAD_PORT) .unwrap(); - let tx_buf = [0; IO_BUFFER_SIZE]; let mut rx_buf = [0; IO_BUFFER_SIZE]; @@ -220,7 +226,7 @@ fn test_upload_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi:: } socket.work(); - + if let Ok(len) = socket.read(&mut rx_buf) { total += len; } else { @@ -236,4 +242,4 @@ fn test_upload_download<'a>(server_address: Ipv4Address, socket: &mut esp_wifi:: println!("upload+download: {} kB/s", kbps); socket.disconnect(); -} \ No newline at end of file +} diff --git a/esp-wifi/examples/embassy_bench.rs b/esp-wifi/examples/embassy_bench.rs index bd90f051..4e5df0c1 100644 --- a/esp-wifi/examples/embassy_bench.rs +++ b/esp-wifi/examples/embassy_bench.rs @@ -150,10 +150,7 @@ async fn net_task(stack: &'static Stack>) { stack.run().await } -async fn test_download( - server_address: Ipv4Address, - socket: &mut TcpSocket<'_>, -) -> usize { +async fn test_download(server_address: Ipv4Address, socket: &mut TcpSocket<'_>) -> usize { println!("Testing download..."); socket.abort(); @@ -191,10 +188,7 @@ async fn test_download( kbps } -async fn test_upload( - server_address: Ipv4Address, - socket: &mut TcpSocket<'_>, -) -> usize { +async fn test_upload(server_address: Ipv4Address, socket: &mut TcpSocket<'_>) -> usize { println!("Testing upload..."); socket.abort(); socket.set_timeout(Some(Duration::from_secs(10))); @@ -231,10 +225,7 @@ async fn test_upload( kbps } -async fn test_upload_download( - server_address: Ipv4Address, - socket: &mut TcpSocket<'_>, -) -> usize { +async fn test_upload_download(server_address: Ipv4Address, socket: &mut TcpSocket<'_>) -> usize { println!("Testing upload+download..."); socket.abort();