Skip to content

Commit 754f958

Browse files
committed
cargo fmt
1 parent 97a63bc commit 754f958

File tree

3 files changed

+24
-26
lines changed

3 files changed

+24
-26
lines changed

src/bluetooth.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ use bluer::{
77
Adapter, Address, Uuid,
88
};
99
use futures::StreamExt;
10-
use simplelog::*;
1110
use simple_config_parser::Config;
11+
use simplelog::*;
1212
use std::sync::Arc;
1313
use std::time::{Duration, Instant};
1414
use tokio::io::AsyncReadExt;
@@ -88,7 +88,7 @@ async fn power_up_and_wait_for_connection(
8888
};
8989
}
9090
Some(btalias) => {
91-
alias = btalias;
91+
alias = btalias;
9292
}
9393
}
9494
info!("{} 🥏 Bluetooth alias: <bold><green>{}</>", NAME, alias);
@@ -361,15 +361,15 @@ pub async fn bluetooth_setup_connection(
361361

362362
let (state, mut stream) = power_up_and_wait_for_connection(advertise, btalias, connect).await?;
363363

364-
365364
// Get UP interface and IP
366365
for ifa in netif::up().unwrap() {
367366
match ifa.name() {
368367
val if val == iface => {
369368
debug!("Found interface: {:?}", ifa);
370369
// IPv4 Address contains None scope_id, while IPv6 contains Some
371-
match ifa.scope_id() { None => {
372-
wlan_ip_addr = ifa.address().to_string();
370+
match ifa.scope_id() {
371+
None => {
372+
wlan_ip_addr = ifa.address().to_string();
373373
break;
374374
}
375375
_ => (),
@@ -380,9 +380,7 @@ pub async fn bluetooth_setup_connection(
380380
}
381381

382382
// Create a new config from hostapd.conf
383-
let hostapd = Config::new()
384-
.file(HOSTAPD_FILE)
385-
.unwrap();
383+
let hostapd = Config::new().file(HOSTAPD_FILE).unwrap();
386384

387385
// read SSID and WPA_KEY
388386
let wlan_ssid = &hostapd.get_str("ssid").unwrap();
@@ -401,7 +399,10 @@ pub async fn bluetooth_setup_connection(
401399
let mut info = WifiInfoResponse::new();
402400
info.set_ssid(String::from(wlan_ssid));
403401
info.set_key(String::from(wlan_wpa_key));
404-
info!("{} 🛜 Sending Host SSID and Password: {}, {}", NAME, wlan_ssid, wlan_wpa_key);
402+
info!(
403+
"{} 🛜 Sending Host SSID and Password: {}, {}",
404+
NAME, wlan_ssid, wlan_wpa_key
405+
);
405406
let bssid = mac_address::mac_address_by_name(iface)
406407
.unwrap()
407408
.unwrap()

src/main.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -59,27 +59,16 @@ struct Args {
5959
stats_interval: u16,
6060

6161
/// UDC Controller name
62-
#[clap(
63-
short,
64-
long
65-
)]
62+
#[clap(short, long)]
6663
udc: Option<String>,
6764

6865
/// WLAN / Wi-Fi Hotspot interface
69-
#[clap(
70-
short,
71-
long,
72-
default_value = "wlan0"
73-
)]
66+
#[clap(short, long, default_value = "wlan0")]
7467
iface: String,
7568

76-
/// BLE device name
77-
#[clap(
78-
short,
79-
long
80-
)]
69+
/// BLE device name
70+
#[clap(short, long)]
8171
btalias: Option<String>,
82-
8372
}
8473

8574
fn logging_init(debug: bool, log_path: &PathBuf) {
@@ -151,7 +140,15 @@ async fn tokio_main(
151140

152141
let bt_stop;
153142
loop {
154-
match bluetooth_setup_connection(advertise, btalias.clone(), &iface, connect, tcp_start.clone()).await {
143+
match bluetooth_setup_connection(
144+
advertise,
145+
btalias.clone(),
146+
&iface,
147+
connect,
148+
tcp_start.clone(),
149+
)
150+
.await
151+
{
155152
Ok(state) => {
156153
// we're ready, gracefully shutdown bluetooth in task
157154
bt_stop = tokio::spawn(async move { bluetooth_stop(state).await });

src/usb_gadget.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl UsbGadgetState {
6262
configfs_path: PathBuf::from("/sys/kernel/config/usb_gadget"),
6363
udc_name: String::new(),
6464
legacy,
65-
udc
65+
udc,
6666
};
6767

6868
// If UDC argument is passed, use it, otherwise check sys

0 commit comments

Comments
 (0)