Skip to content

Commit ad39ac5

Browse files
committed
bluetooth: simplify matching alias
1 parent ab34499 commit ad39ac5

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

src/bluetooth.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,13 @@ async fn power_up_and_wait_for_connection(
7878
connect: Option<Address>,
7979
) -> Result<(BluetoothState, Stream)> {
8080
// setting BT alias for further use
81-
let alias: String;
82-
83-
match btalias {
84-
None => {
85-
alias = match get_cpu_serial_number_suffix().await {
86-
Ok(suffix) => format!("{}-{}", BT_ALIAS, suffix),
87-
Err(_) => String::from(BT_ALIAS),
88-
};
89-
}
90-
Some(btalias) => {
91-
alias = btalias;
92-
}
93-
}
81+
let alias = match btalias {
82+
None => match get_cpu_serial_number_suffix().await {
83+
Ok(suffix) => format!("{}-{}", BT_ALIAS, suffix),
84+
Err(_) => String::from(BT_ALIAS),
85+
},
86+
Some(btalias) => btalias,
87+
};
9488
info!("{} 🥏 Bluetooth alias: <bold><green>{}</>", NAME, alias);
9589

9690
let session = bluer::Session::new().await?;

0 commit comments

Comments
 (0)