From 138446e0400b318c4d253b491a7d0ee470d85b2b Mon Sep 17 00:00:00 2001 From: Sijmen Date: Sun, 14 May 2023 15:46:43 +0200 Subject: [PATCH] Format and apply Clippy suggestions --- src/main.rs | 5 +++-- src/mpd.rs | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7270417..2a86565 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{path::Path, collections::HashMap}; +use std::{collections::HashMap, path::Path}; use askama::Template; use percent_encoding::percent_decode_str; @@ -176,7 +176,8 @@ struct UpdateQueueBody { async fn post_queue_move(mut req: tide::Request<()>) -> tide::Result { let body: UpdateQueueBody = req.body_json().await?; let mut mpd = mpd::Mpd::connect().await?; - mpd.command(&format!("move {} {}", body.from, body.to)).await?; + mpd.command(&format!("move {} {}", body.from, body.to)) + .await?; Ok("".into()) } diff --git a/src/mpd.rs b/src/mpd.rs index 287ab08..544c194 100644 --- a/src/mpd.rs +++ b/src/mpd.rs @@ -246,7 +246,7 @@ impl Mpd { } } - + #[allow(clippy::manual_map)] pub async fn ls(&mut self, path: &str) -> anyhow::Result> { fn get_filename(path: &str) -> String { std::path::Path::new(path) @@ -256,7 +256,7 @@ impl Mpd { } let result = self - .command(&format!("lsinfo \"{}\"", Self::escape_str(&path))) + .command(&format!("lsinfo \"{}\"", Self::escape_str(path))) .await? .into_hashmaps(&["file", "directory", "playlist"]); @@ -265,18 +265,18 @@ impl Mpd { .flat_map(|prop| { if let Some(file) = prop.get("file") { Some(Entry::Song { - name: prop.get("Title").unwrap_or(&get_filename(&file)).clone(), + name: prop.get("Title").unwrap_or(&get_filename(file)).clone(), artist: prop.get("Artist").unwrap_or(&String::new()).clone(), path: file.to_string(), }) } else if let Some(file) = prop.get("directory") { Some(Entry::Directory { - name: get_filename(&file), + name: get_filename(file), path: file.to_string(), }) } else if let Some(file) = prop.get("playlist") { Some(Entry::Playlist { - name: get_filename(&file), + name: get_filename(file), path: file.to_string(), }) } else {