From f079dc74efd938542625eefd6a0637d876785df0 Mon Sep 17 00:00:00 2001 From: Gowtham Suresh Kumar Date: Thu, 11 Jan 2024 11:09:51 +0000 Subject: [PATCH 1/3] Drop private_in_public lint On builds we get the following warning, "warning: lint `private_in_public` has been removed: replaced with another group of lints, see RFC for more information" Signed-off-by: Gowtham Suresh Kumar --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 47cadec..95f9d04 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,7 +9,6 @@ overflowing_literals, path_statements, patterns_in_fns_without_body, - private_in_public, unconditional_recursion, unused, unused_allocation, From f6d57d2b3df142d1ed5a0d025d7b2b55c38eb273 Mon Sep 17 00:00:00 2001 From: Gowtham Suresh Kumar Date: Thu, 11 Jan 2024 11:12:40 +0000 Subject: [PATCH 2/3] Fix unused formatting placeholder warning Signed-off-by: Gowtham Suresh Kumar --- src/operations/utils_deprecated_primitives.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/operations/utils_deprecated_primitives.rs b/src/operations/utils_deprecated_primitives.rs index 6faf0a0..b49605b 100644 --- a/src/operations/utils_deprecated_primitives.rs +++ b/src/operations/utils_deprecated_primitives.rs @@ -464,14 +464,14 @@ mod tests { #[test] fn deprecated_algorithms() { for algo in get_deprecated_algorithms() { - assert!(is_algorithm_deprecated(algo), "algorithm: {algo:?}"); + assert!(is_algorithm_deprecated(algo), "algorithm: {:?}", algo); } } #[test] fn non_deprecated_algorithms() { for algo in get_selection_non_deprecated_algorithms() { - assert!(!is_algorithm_deprecated(algo), "algorithm: {algo:?}"); + assert!(!is_algorithm_deprecated(algo), "algorithm: {:?}", algo); } } @@ -517,7 +517,9 @@ mod tests { for (ktype, ksize) in test_keys { assert!( is_key_deprecated(ktype, ksize), - "key: ({ktype:?} : {ksize:?})" + "key: ({:?} : {:?})", + ktype, + ksize ); } } @@ -569,7 +571,9 @@ mod tests { for (ktype, ksize) in test_keys { assert!( !is_key_deprecated(ktype, ksize), - "key: ({ktype:?} : {ksize:?})" + "key: ({:?} : {:?})", + ktype, + ksize ); } } From 0d1bbf7bbed59bb19fd39ae4aa9b3a20a60b9d59 Mon Sep 17 00:00:00 2001 From: Gowtham Suresh Kumar Date: Thu, 11 Jan 2024 11:14:10 +0000 Subject: [PATCH 3/3] Use infallible from instead of try_from This is a new lint added in 1.75.0 https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fallible_conversions Signed-off-by: Gowtham Suresh Kumar --- src/requests/common/wire_header_1_0.rs | 3 +-- src/requests/request/mod.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/requests/common/wire_header_1_0.rs b/src/requests/common/wire_header_1_0.rs index 9469cb6..86d28bd 100644 --- a/src/requests/common/wire_header_1_0.rs +++ b/src/requests/common/wire_header_1_0.rs @@ -10,7 +10,6 @@ use arbitrary::Arbitrary; use bincode::Options; use log::error; use serde::{Deserialize, Serialize}; -use std::convert::TryFrom; use std::io::{Read, Write}; const WIRE_PROTOCOL_VERSION_MAJ: u8 = 1; @@ -120,7 +119,7 @@ impl WireHeader { } let hdr_size = get_from_stream!(stream, u16); - let mut bytes = vec![0_u8; usize::try_from(hdr_size)?]; + let mut bytes = vec![0_u8; usize::from(hdr_size)]; stream.read_exact(&mut bytes)?; if hdr_size != REQUEST_HDR_SIZE { error!( diff --git a/src/requests/request/mod.rs b/src/requests/request/mod.rs index 6fe5bd3..cdfe72c 100644 --- a/src/requests/request/mod.rs +++ b/src/requests/request/mod.rs @@ -94,7 +94,7 @@ impl Request { return Err(ResponseStatus::BodySizeExceedsLimit); } let body = RequestBody::read_from_stream(stream, body_len)?; - let auth = RequestAuth::read_from_stream(stream, usize::try_from(raw_header.auth_len)?)?; + let auth = RequestAuth::read_from_stream(stream, usize::from(raw_header.auth_len))?; Ok(Request { header: raw_header.try_into()?,