diff --git a/plugins/xcp-metrics-plugin-bridge-v2/src/main.rs b/plugins/xcp-metrics-plugin-bridge-v2/src/main.rs index 34b19b8..1575742 100644 --- a/plugins/xcp-metrics-plugin-bridge-v2/src/main.rs +++ b/plugins/xcp-metrics-plugin-bridge-v2/src/main.rs @@ -1,9 +1,4 @@ -use std::{ - collections::HashMap, - ops::Deref, - path::{Path, PathBuf}, - time::Duration, -}; +use std::{collections::HashMap, path::PathBuf, time::Duration}; use clap::{command, Parser}; use tokio::time; diff --git a/plugins/xcp-metrics-plugin-common/src/plugin.rs b/plugins/xcp-metrics-plugin-common/src/plugin.rs index 2e0a7cd..e182d5c 100644 --- a/plugins/xcp-metrics-plugin-common/src/plugin.rs +++ b/plugins/xcp-metrics-plugin-common/src/plugin.rs @@ -48,7 +48,7 @@ pub async fn run_hybrid( .starts_with("rrdp-") { tracing::info!("Program name starts with rrdp-*, use xcp-rrdd and protocol-v2 by default."); - target_daemon_path = Some(&Path::new(&XCP_RRDD_PATH)); + target_daemon_path = Some(Path::new(&XCP_RRDD_PATH)); version = Some(2); } diff --git a/plugins/xcp-metrics-plugin-common/src/protocol_v2.rs b/plugins/xcp-metrics-plugin-common/src/protocol_v2.rs index c2fbcbd..8bf07ff 100644 --- a/plugins/xcp-metrics-plugin-common/src/protocol_v2.rs +++ b/plugins/xcp-metrics-plugin-common/src/protocol_v2.rs @@ -38,7 +38,7 @@ impl RrddPlugin { header, metrics_path: Path::new(METRICS_SHM_PATH).join(uid), target_daemon_path: target_daemon_path - .unwrap_or(&Path::new(DEFAULT_DAEMON)) + .unwrap_or(Path::new(DEFAULT_DAEMON)) .to_path_buf(), }; diff --git a/plugins/xcp-metrics-plugin-common/src/protocol_v3/mod.rs b/plugins/xcp-metrics-plugin-common/src/protocol_v3/mod.rs index 2f8a13e..1e5f13d 100644 --- a/plugins/xcp-metrics-plugin-common/src/protocol_v3/mod.rs +++ b/plugins/xcp-metrics-plugin-common/src/protocol_v3/mod.rs @@ -30,7 +30,7 @@ impl MetricsPlugin { uid: uid.into(), metrics_path: Path::new(METRICS_SHM_PATH).join(uid), target_daemon_path: target_daemon_path - .unwrap_or(&Path::new(&DEFAULT_DAEMON)) + .unwrap_or(Path::new(&DEFAULT_DAEMON)) .to_path_buf(), }; diff --git a/plugins/xcp-metrics-plugin-common/src/xenstore/mock.rs b/plugins/xcp-metrics-plugin-common/src/xenstore/mock.rs index bc74f7f..6b77b56 100644 --- a/plugins/xcp-metrics-plugin-common/src/xenstore/mock.rs +++ b/plugins/xcp-metrics-plugin-common/src/xenstore/mock.rs @@ -206,7 +206,6 @@ fn test_watch() { } #[test] -#[cfg(features = "xenstore-write")] fn test_subdirectories() { let xs = MockXs::default(); diff --git a/xapi-rs/src/rpc/message.rs b/xapi-rs/src/rpc/message.rs index 1641553..d8439c3 100644 --- a/xapi-rs/src/rpc/message.rs +++ b/xapi-rs/src/rpc/message.rs @@ -102,10 +102,12 @@ impl RpcRequest { /// Write the serialized [RpcRequest] to `writer`. pub fn write(&self, writer: &mut W) -> anyhow::Result<()> { - Ok(match self { + match self { RpcRequest::XmlRpc(method) => write_xml(writer, method)?, RpcRequest::JsonRpc(request) => serde_json::to_writer(writer, request)?, - }) + } + + Ok(()) } /// Parse a [RpcRequest] from a http request (either XML-RPC or JSON-RPC). diff --git a/xcp-metrics/src/main.rs b/xcp-metrics/src/main.rs index af10bfa..798832f 100644 --- a/xcp-metrics/src/main.rs +++ b/xcp-metrics/src/main.rs @@ -73,7 +73,7 @@ async fn check_unix_socket(socket_path: &Path) -> anyhow::Result { socket = socket_path.to_str(), "Unlinking inactive XAPI socket" ); - fs::remove_file(&socket_path)?; + fs::remove_file(socket_path)?; Ok(false) } else { tracing::error!( @@ -129,12 +129,12 @@ async fn main() { let forwarded_path = format!("{}.forwarded", daemon_path.to_string_lossy()); - if check_unix_socket(&Path::new(&daemon_path)).await.unwrap() { + if check_unix_socket(Path::new(&daemon_path)).await.unwrap() { tracing::error!("Unable to start: xcp-metrics socket is active"); panic!("Unable to start: is xcp-metrics already running ?"); } - if check_unix_socket(&Path::new(&forwarded_path)) + if check_unix_socket(Path::new(&forwarded_path)) .await .unwrap() { diff --git a/xcp-metrics/src/publishers/rrdd/mod.rs b/xcp-metrics/src/publishers/rrdd/mod.rs index 78ec8e0..6ddb614 100644 --- a/xcp-metrics/src/publishers/rrdd/mod.rs +++ b/xcp-metrics/src/publishers/rrdd/mod.rs @@ -36,7 +36,7 @@ pub struct RrdXportParameters { } #[derive(Copy, Clone)] -pub(self) enum Granuality { +enum Granuality { FiveSeconds, Minute, Hour,