mirror of
https://git.proxmox.com/git/proxmox
synced 2025-06-13 14:48:37 +00:00
misc clippy fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
9539fbde1c
commit
ca563a8cfd
@ -742,7 +742,7 @@ impl WebSocket {
|
|||||||
async fn copy_to_websocket<R, W>(
|
async fn copy_to_websocket<R, W>(
|
||||||
&self,
|
&self,
|
||||||
mut reader: &mut R,
|
mut reader: &mut R,
|
||||||
mut writer: &mut WebSocketWriter<W>,
|
writer: &mut WebSocketWriter<W>,
|
||||||
receiver: &mut mpsc::UnboundedReceiver<WebSocketReadResult>,
|
receiver: &mut mpsc::UnboundedReceiver<WebSocketReadResult>,
|
||||||
) -> Result<bool, Error>
|
) -> Result<bool, Error>
|
||||||
where
|
where
|
||||||
@ -757,7 +757,7 @@ impl WebSocket {
|
|||||||
res = buf.read_from_async(&mut reader).fuse() => res?,
|
res = buf.read_from_async(&mut reader).fuse() => res?,
|
||||||
res = receiver.recv().fuse() => {
|
res = receiver.recv().fuse() => {
|
||||||
let res = res.ok_or_else(|| format_err!("control channel closed"))?;
|
let res = res.ok_or_else(|| format_err!("control channel closed"))?;
|
||||||
match self.handle_channel_message(res, &mut writer).await? {
|
match self.handle_channel_message(res, writer).await? {
|
||||||
OpCode::Close => return Ok(true),
|
OpCode::Close => return Ok(true),
|
||||||
_ => { continue; },
|
_ => { continue; },
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ pub(crate) fn format_influxdb_line(data: &MetricsData) -> Result<String, Error>
|
|||||||
line.push(',');
|
line.push(',');
|
||||||
}
|
}
|
||||||
first = false;
|
first = false;
|
||||||
write!(line, "{}={}", escape_key(key), value.to_string())?;
|
write!(line, "{}={}", escape_key(key), value)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nanosecond precision
|
// nanosecond precision
|
||||||
|
@ -123,12 +123,12 @@ pub mod string_as_base64 {
|
|||||||
use serde::de::Error;
|
use serde::de::Error;
|
||||||
|
|
||||||
let bytes = base64::decode(&string).map_err(|err| {
|
let bytes = base64::decode(&string).map_err(|err| {
|
||||||
let msg = format!("base64 decode: {}", err.to_string());
|
let msg = format!("base64 decode: {}", err);
|
||||||
Error::custom(msg)
|
Error::custom(msg)
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
String::from_utf8(bytes).map_err(|err| {
|
String::from_utf8(bytes).map_err(|err| {
|
||||||
let msg = format!("utf8 decode: {}", err.to_string());
|
let msg = format!("utf8 decode: {}", err);
|
||||||
Error::custom(msg)
|
Error::custom(msg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ fn create_test_dir<T: Init>(filename: &str) -> Option<PathBuf> {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_shared_memory_mutex() -> Result<(), Error> {
|
fn test_shared_memory_mutex() -> Result<(), Error> {
|
||||||
let path = match create_test_dir::<SingleMutexData>(&"data1.shm") {
|
let path = match create_test_dir::<SingleMutexData>("data1.shm") {
|
||||||
None => { return Ok(()); }, // no O_TMPFILE support, can't run test
|
None => { return Ok(()); }, // no O_TMPFILE support, can't run test
|
||||||
Some(path) => path,
|
Some(path) => path,
|
||||||
};
|
};
|
||||||
@ -136,7 +136,7 @@ fn test_shared_memory_mutex() -> Result<(), Error> {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_shared_memory_multi_mutex() -> Result<(), Error> {
|
fn test_shared_memory_multi_mutex() -> Result<(), Error> {
|
||||||
let path = match create_test_dir::<SingleMutexData>(&"data2.shm") {
|
let path = match create_test_dir::<SingleMutexData>("data2.shm") {
|
||||||
None => { return Ok(()); }, // no O_TMPFILE support, can't run test
|
None => { return Ok(()); }, // no O_TMPFILE support, can't run test
|
||||||
Some(path) => path,
|
Some(path) => path,
|
||||||
};
|
};
|
||||||
|
@ -312,7 +312,7 @@ fn test_entry() {
|
|||||||
);
|
);
|
||||||
assert_eq!(entry.fs_type, "cgroup");
|
assert_eq!(entry.fs_type, "cgroup");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
entry.mount_source.as_ref().map(|s| s.as_os_str()),
|
entry.mount_source.as_deref(),
|
||||||
Some(OsStr::new("cgroup"))
|
Some(OsStr::new("cgroup"))
|
||||||
);
|
);
|
||||||
assert_eq!(entry.super_options, "rw,blkio");
|
assert_eq!(entry.super_options, "rw,blkio");
|
||||||
@ -341,7 +341,7 @@ fn test_entry() {
|
|||||||
);
|
);
|
||||||
assert_eq!(entry.fs_type, "autofs");
|
assert_eq!(entry.fs_type, "autofs");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
entry.mount_source.as_ref().map(|s| s.as_os_str()),
|
entry.mount_source.as_deref(),
|
||||||
Some(OsStr::new("systemd-1"))
|
Some(OsStr::new("systemd-1"))
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
@ -525,7 +525,7 @@ fn test_otp() {
|
|||||||
assert_eq!(parsed, hotp);
|
assert_eq!(parsed, hotp);
|
||||||
assert_eq!(parsed.issuer, None);
|
assert_eq!(parsed.issuer, None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parsed.account_name.as_ref().map(String::as_str),
|
parsed.account_name.as_deref(),
|
||||||
Some("My Account")
|
Some("My Account")
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -558,11 +558,11 @@ fn test_otp() {
|
|||||||
let parsed: Totp = uri.parse().expect("failed to parse otp uri");
|
let parsed: Totp = uri.parse().expect("failed to parse otp uri");
|
||||||
assert_eq!(parsed, totp);
|
assert_eq!(parsed, totp);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parsed.issuer.as_ref().map(String::as_str),
|
parsed.issuer.as_deref(),
|
||||||
Some("An Issuer")
|
Some("An Issuer")
|
||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parsed.account_name.as_ref().map(String::as_str),
|
parsed.account_name.as_deref(),
|
||||||
Some("The Account Name")
|
Some("The Account Name")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -522,7 +522,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let ts: TestChallenge =
|
let ts: TestChallenge =
|
||||||
serde_json::from_str(&data).expect("failed to parse json test data");
|
serde_json::from_str(data).expect("failed to parse json test data");
|
||||||
|
|
||||||
let context = super::U2f::new(TEST_APPID.to_string(), TEST_APPID.to_string());
|
let context = super::U2f::new(TEST_APPID.to_string(), TEST_APPID.to_string());
|
||||||
let res = context
|
let res = context
|
||||||
@ -546,7 +546,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let ts: TestChallenge =
|
let ts: TestChallenge =
|
||||||
serde_json::from_str(&data).expect("failed to parse json test data");
|
serde_json::from_str(data).expect("failed to parse json test data");
|
||||||
|
|
||||||
let context = super::U2f::new(TEST_APPID.to_string(), TEST_APPID.to_string());
|
let context = super::U2f::new(TEST_APPID.to_string(), TEST_APPID.to_string());
|
||||||
let res = context
|
let res = context
|
||||||
|
Loading…
Reference in New Issue
Block a user