From 3b46dcc6bb454ecc0a8da44aec2bb4e86ac3c7bf Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Tue, 10 Oct 2023 22:15:48 +0100 Subject: [PATCH] refactor: fix clippy warnings --- Cargo.lock | 5 +++-- Cargo.toml | 1 + src/main.rs | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4932384..97a2361 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -649,6 +649,7 @@ dependencies = [ "regex", "reqwest", "serde", + "serde_json", "tokio", "toml 0.8.2", "tracing", @@ -1166,9 +1167,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", diff --git a/Cargo.toml b/Cargo.toml index 03d2287..9c17f4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ dirs = "5.0.1" toml = "0.8.2" regex = "1.9.6" serde = { version = "1.0.188", features = ["derive"] } +serde_json = "1.0.107" reqwest = { version = "0.11.22", features = ["json"] } tokio = { version = "1.33.0", features = ["rt-multi-thread"] } universal-config = { version = "0.4.3", default-features = false, features = ["toml"] } diff --git a/src/main.rs b/src/main.rs index 833eb2a..7fac151 100644 --- a/src/main.rs +++ b/src/main.rs @@ -106,14 +106,14 @@ impl<'a> Service<'a> { drpc.on_ready(move |_| { event_tx .try_send(ServiceEvent::Ready) - .expect("channel to be open") + .expect("channel to be open"); }); drpc.on_error(move |err| { if err .event .get("error_message") - .and_then(|v| v.as_str()) + .and_then(serde_json::value::Value::as_str) .map(|str| str == "Io Error") .unwrap_or_default() { @@ -133,7 +133,7 @@ impl<'a> Service<'a> { } fn start(&mut self) { - self.drpc.start() + self.drpc.start(); } async fn update_state(&mut self, mpd: &MultiHostClient<'a>, status: &Status) {