Apply clippy lint

Signed-off-by: x1a0b0 <xbtseng@gmail.com>
This commit is contained in:
x1a0b0
2025-10-13 11:34:44 +08:00
parent d43a9588c9
commit 61943b16ac
6 changed files with 8 additions and 14 deletions
+3 -6
View File
@@ -147,12 +147,9 @@ async fn on_event(event: Event) -> Result<(), AppError> {
async fn on_stream(stream: Stream) -> Result<(), AppError> {
let Stream { tag, bytes, .. } = stream;
match tag.as_str() {
"play" => {
// 播放接收到的音频流
let _ = AudioPlayer::instance().play(bytes).await;
}
_ => {}
if tag.as_str() == "play" {
// 播放接收到的音频流
let _ = AudioPlayer::instance().play(bytes).await;
}
Ok(())
}
+1 -1
View File
@@ -29,7 +29,7 @@ async fn on_keyword(_keyword: String) {
.split("\n")
.filter(|line| !line.trim().is_empty())
.collect::<Vec<&str>>();
if replies.len() > 0 {
if !replies.is_empty() {
wakeup_sounds.clear();
wakeup_sounds.extend(replies.iter().map(|s| s.to_string()));
}
@@ -39,7 +39,7 @@ impl AudioPlayer {
}
if let Some(task) = self.player_task.lock().await.take() {
let _ = task.abort();
task.abort();
}
if let Some(mut write_thread) = self.write_thread.lock().await.take() {
+1 -4
View File
@@ -73,9 +73,6 @@ impl EventBus {
async fn get_callbacks(&self, event: &str) -> Option<Vec<EventCallback>> {
let subscribers = self.subscribers.lock().await;
match subscribers.get(event) {
Some(callbacks) => Some(callbacks.clone()),
None => None,
}
subscribers.get(event).cloned()
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
pub mod event;
pub mod rand;
pub mod shell;
pub mod task;
pub mod rand;
+1 -1
View File
@@ -35,7 +35,7 @@ impl TaskManager {
let mut tasks = self.tasks.lock().await;
if let Some(handles) = tasks.remove(tag) {
for handle in handles {
let _ = handle.abort();
handle.abort();
}
}
}