fix: resolve clippy warnings in iced client

This commit is contained in:
ReTeamSpeak
2026-05-13 16:06:04 +09:00
parent 358aaa2ea5
commit 43967cf309
3 changed files with 25 additions and 33 deletions
+19 -22
View File
@@ -605,7 +605,7 @@ impl App {
let _ = handle
.with_connection(move |con| -> Result<(), String> {
let state = con.get_state().map_err(|e| e.to_string())?;
if state.clients.get(&state.own_client).is_some() {
if state.clients.contains_key(&state.own_client) {
let cmd = state.client_update()
.set_input_muted(muted);
cmd.send(con).map_err(|e| e.to_string())?;
@@ -629,7 +629,7 @@ impl App {
let _ = handle
.with_connection(move |con| -> Result<(), String> {
let state = con.get_state().map_err(|e| e.to_string())?;
if state.clients.get(&state.own_client).is_some() {
if state.clients.contains_key(&state.own_client) {
let cmd = state.client_update()
.set_output_muted(muted);
cmd.send(con).map_err(|e| e.to_string())?;
@@ -653,7 +653,7 @@ impl App {
let _ = handle
.with_connection(move |con| -> Result<(), String> {
let state = con.get_state().map_err(|e| e.to_string())?;
if state.clients.get(&state.own_client).is_some() {
if state.clients.contains_key(&state.own_client) {
let cmd = state.client_update()
.set_output_hardware_enabled(!muted);
cmd.send(con).map_err(|e| e.to_string())?;
@@ -677,7 +677,7 @@ impl App {
let _ = handle
.with_connection(move |con| -> Result<(), String> {
let state = con.get_state().map_err(|e| e.to_string())?;
if state.clients.get(&state.own_client).is_some() {
if state.clients.contains_key(&state.own_client) {
let cmd = if afk {
state.client_update()
.set_input_muted(true)
@@ -909,18 +909,20 @@ impl App {
// Keyboard events for PTT
subs.push(iced::event::listen().map(|event| {
match event {
iced::Event::Keyboard(iced::keyboard::Event::KeyPressed { ref key, .. }) => {
if let iced::keyboard::Key::Character(c) = key {
if c.as_str().to_lowercase() == "v" {
return Message::PttPressed;
}
iced::Event::Keyboard(iced::keyboard::Event::KeyPressed {
key: iced::keyboard::Key::Character(c),
..
}) => {
if c.as_str().to_lowercase() == "v" {
return Message::PttPressed;
}
}
iced::Event::Keyboard(iced::keyboard::Event::KeyReleased { ref key, .. }) => {
if let iced::keyboard::Key::Character(c) = key {
if c.as_str().to_lowercase() == "v" {
return Message::PttReleased;
}
iced::Event::Keyboard(iced::keyboard::Event::KeyReleased {
key: iced::keyboard::Key::Character(c),
..
}) => {
if c.as_str().to_lowercase() == "v" {
return Message::PttReleased;
}
}
_ => {}
@@ -972,14 +974,9 @@ impl App {
return;
}
}
loop {
match sample_rx.recv() {
Ok(samples) => {
if sender.send(Message::MicSamples(samples)).await.is_err() {
break;
}
}
Err(_) => break,
while let Ok(samples) = sample_rx.recv() {
if sender.send(Message::MicSamples(samples)).await.is_err() {
break;
}
}
let mut mic_guard = mic.lock().await;
+5 -10
View File
@@ -88,16 +88,11 @@ pub fn start_transmission(
}
});
loop {
match sample_rx.recv() {
Ok(samples) => {
let mut nr = noise_reducer.lock().await;
let mut samples_copy = samples.clone();
nr.process(&mut samples_copy);
enc.encode_and_send(&samples_copy, &audio_tx);
}
Err(_) => break,
}
while let Ok(samples) = sample_rx.recv() {
let mut nr = noise_reducer.lock().await;
let mut samples_copy = samples.clone();
nr.process(&mut samples_copy);
enc.encode_and_send(&samples_copy, &audio_tx);
}
let mut mic_guard = mic.lock().await;
+1 -1
View File
@@ -855,7 +855,7 @@ impl App {
pub(crate) fn recent_bookmarks(&self, limit: usize) -> Vec<&BookmarkInfo> {
let mut bookmarks: Vec<&BookmarkInfo> = self.bookmarks.iter().collect();
bookmarks.sort_by(|a, b| b.last_used_at.cmp(&a.last_used_at));
bookmarks.sort_by_key(|bookmark| std::cmp::Reverse(bookmark.last_used_at));
bookmarks
.into_iter()
.filter(|bookmark| bookmark.last_used_at.is_some())