misc clippy fixes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2022-02-08 14:23:36 +01:00
parent 9539fbde1c
commit ca563a8cfd
7 changed files with 14 additions and 14 deletions

View File

@ -742,7 +742,7 @@ impl WebSocket {
async fn copy_to_websocket<R, W>(
&self,
mut reader: &mut R,
mut writer: &mut WebSocketWriter<W>,
writer: &mut WebSocketWriter<W>,
receiver: &mut mpsc::UnboundedReceiver<WebSocketReadResult>,
) -> Result<bool, Error>
where
@ -757,7 +757,7 @@ impl WebSocket {
res = buf.read_from_async(&mut reader).fuse() => res?,
res = receiver.recv().fuse() => {
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),
_ => { continue; },
}

View File

@ -29,7 +29,7 @@ pub(crate) fn format_influxdb_line(data: &MetricsData) -> Result<String, Error>
line.push(',');
}
first = false;
write!(line, "{}={}", escape_key(key), value.to_string())?;
write!(line, "{}={}", escape_key(key), value)?;
}
// nanosecond precision

View File

@ -123,12 +123,12 @@ pub mod string_as_base64 {
use serde::de::Error;
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)
})?;
String::from_utf8(bytes).map_err(|err| {
let msg = format!("utf8 decode: {}", err.to_string());
let msg = format!("utf8 decode: {}", err);
Error::custom(msg)
})
}

View File

@ -100,7 +100,7 @@ fn create_test_dir<T: Init>(filename: &str) -> Option<PathBuf> {
}
#[test]
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
Some(path) => path,
};
@ -136,7 +136,7 @@ fn test_shared_memory_mutex() -> Result<(), Error> {
#[test]
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
Some(path) => path,
};

View File

@ -312,7 +312,7 @@ fn test_entry() {
);
assert_eq!(entry.fs_type, "cgroup");
assert_eq!(
entry.mount_source.as_ref().map(|s| s.as_os_str()),
entry.mount_source.as_deref(),
Some(OsStr::new("cgroup"))
);
assert_eq!(entry.super_options, "rw,blkio");
@ -341,7 +341,7 @@ fn test_entry() {
);
assert_eq!(entry.fs_type, "autofs");
assert_eq!(
entry.mount_source.as_ref().map(|s| s.as_os_str()),
entry.mount_source.as_deref(),
Some(OsStr::new("systemd-1"))
);
assert_eq!(

View File

@ -525,7 +525,7 @@ fn test_otp() {
assert_eq!(parsed, hotp);
assert_eq!(parsed.issuer, None);
assert_eq!(
parsed.account_name.as_ref().map(String::as_str),
parsed.account_name.as_deref(),
Some("My Account")
);
@ -558,11 +558,11 @@ fn test_otp() {
let parsed: Totp = uri.parse().expect("failed to parse otp uri");
assert_eq!(parsed, totp);
assert_eq!(
parsed.issuer.as_ref().map(String::as_str),
parsed.issuer.as_deref(),
Some("An Issuer")
);
assert_eq!(
parsed.account_name.as_ref().map(String::as_str),
parsed.account_name.as_deref(),
Some("The Account Name")
);
}

View File

@ -522,7 +522,7 @@ mod test {
}
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 res = context
@ -546,7 +546,7 @@ mod test {
}
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 res = context