Fix Rust linter errors

This commit is contained in:
Josh Wu
2025-07-02 12:32:41 +08:00
parent 88777710a4
commit 3cb97d2373
6 changed files with 18 additions and 18 deletions

View File

@@ -56,7 +56,7 @@ pub async fn start(args: &Args, device: &mut Device) -> PyResult<()> {
ble_connection.on_disconnection(|_py, reason| {
let disconnection_info = match HciConstant::error_name(reason) {
Ok(info_string) => info_string,
Err(py_err) => format!("failed to get disconnection error name ({})", py_err),
Err(py_err) => format!("failed to get disconnection error name ({py_err})"),
};
println!(
"{} {}",
@@ -114,10 +114,10 @@ async fn proxy_data_between_tcp_and_l2cap(
mtu: Option<u16>,
mps: Option<u16>,
) -> PyResult<()> {
println!("{}", format!("<<< TCP connection from {}", addr).magenta());
println!("{}", format!("<<< TCP connection from {addr}").magenta());
println!(
"{}",
format!(">>> Opening L2CAP channel on PSM = {}", psm).yellow()
format!(">>> Opening L2CAP channel on PSM = {psm}").yellow()
);
let mut l2cap_channel = match ble_connection

View File

@@ -158,7 +158,7 @@ async fn proxy_tcp_rx_to_l2cap_tx(
}
}
Err(e) => {
println!("{}", format!("!!! TCP connection lost: {}", e).red());
println!("{}", format!("!!! TCP connection lost: {e}").red());
if let Some(mut channel) = l2cap_channel.lock().await.take() {
let _ = channel.disconnect().await.map_err(|e| {
eprintln!("Failed to call disconnect on l2cap channel: {e}");

View File

@@ -83,7 +83,7 @@ pub async fn start(args: &Args, device: &mut Device) -> PyResult<()> {
connection.on_disconnection(|_py, reason| {
let disconnection_info = match HciConstant::error_name(reason) {
Ok(info_string) => info_string,
Err(py_err) => format!("failed to get disconnection error name ({})", py_err),
Err(py_err) => format!("failed to get disconnection error name ({py_err})"),
};
println!(
"{} {}",

View File

@@ -100,7 +100,7 @@ pub(crate) fn probe(verbose: bool) -> anyhow::Result<()> {
.map(|serials| serials.contains(s))
.unwrap_or(false)
{
transport_names.push(format!("{}/{}", basic_transport_name, s))
transport_names.push(format!("{basic_transport_name}/{s}"))
}
}
@@ -310,7 +310,7 @@ impl ClassInfo {
self.sub_class,
self.protocol,
self.protocol_name()
.map(|s| format!(" [{}]", s))
.map(|s| format!(" [{s}]"))
.unwrap_or_default()
)
}