Skip to content

Commit

Permalink
Cargo clippy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TSnake41 committed Aug 29, 2023
1 parent ce3a549 commit 68293e5
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 16 deletions.
7 changes: 1 addition & 6 deletions plugins/xcp-metrics-plugin-bridge-v2/src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion plugins/xcp-metrics-plugin-common/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/xcp-metrics-plugin-common/src/protocol_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};

Expand Down
2 changes: 1 addition & 1 deletion plugins/xcp-metrics-plugin-common/src/protocol_v3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};

Expand Down
1 change: 0 additions & 1 deletion plugins/xcp-metrics-plugin-common/src/xenstore/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ fn test_watch() {
}

#[test]
#[cfg(features = "xenstore-write")]
fn test_subdirectories() {
let xs = MockXs::default();

Expand Down
6 changes: 4 additions & 2 deletions xapi-rs/src/rpc/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ impl RpcRequest {

/// Write the serialized [RpcRequest] to `writer`.
pub fn write<W: 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).
Expand Down
6 changes: 3 additions & 3 deletions xcp-metrics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn check_unix_socket(socket_path: &Path) -> anyhow::Result<bool> {
socket = socket_path.to_str(),
"Unlinking inactive XAPI socket"
);
fs::remove_file(&socket_path)?;
fs::remove_file(socket_path)?;
Ok(false)
} else {
tracing::error!(
Expand Down Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion xcp-metrics/src/publishers/rrdd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct RrdXportParameters {
}

#[derive(Copy, Clone)]
pub(self) enum Granuality {
enum Granuality {
FiveSeconds,
Minute,
Hour,
Expand Down

0 comments on commit 68293e5

Please sign in to comment.