mirror of
https://github.com/rustfs/rustfs.git
synced 2026-01-17 01:30:33 +00:00
fix: resolve clippy warnings in signer module
- Add #[allow(clippy::too_many_arguments)] for functions with 8 parameters - Replace vec initialization with array where appropriate - Fix test code warnings by adding #[allow] attributes - Improve code quality while maintaining functionality
This commit is contained in:
@@ -52,6 +52,7 @@ fn _build_chunk_signature(
|
||||
get_signature(signing_key, &chunk_string_to_sign)
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn streaming_sign_v4(
|
||||
mut req: request::Builder,
|
||||
_access_key_id: &str,
|
||||
|
||||
@@ -172,13 +172,14 @@ fn get_canonical_request(req: &request::Builder, ignored_headers: &HashMap<Strin
|
||||
canonical_query_string = canonical_query_string.replace("+", "%20");
|
||||
}
|
||||
|
||||
let mut canonical_request = <Vec<String>>::new();
|
||||
canonical_request.push(req.method_ref().unwrap().to_string());
|
||||
canonical_request.push(req.uri_ref().unwrap().path().to_string());
|
||||
canonical_request.push(canonical_query_string);
|
||||
canonical_request.push(get_canonical_headers(req, ignored_headers));
|
||||
canonical_request.push(get_signed_headers(req, ignored_headers));
|
||||
canonical_request.push(hashed_payload.to_string());
|
||||
let canonical_request = [
|
||||
req.method_ref().unwrap().to_string(),
|
||||
req.uri_ref().unwrap().path().to_string(),
|
||||
canonical_query_string,
|
||||
get_canonical_headers(req, ignored_headers),
|
||||
get_signed_headers(req, ignored_headers),
|
||||
hashed_payload.to_string(),
|
||||
];
|
||||
canonical_request.join("\n")
|
||||
}
|
||||
|
||||
@@ -267,6 +268,7 @@ fn _sign_v4_sts(req: request::Builder, access_key_id: &str, secret_access_key: &
|
||||
sign_v4_inner(req, 0, access_key_id, secret_access_key, "", location, SERVICE_TYPE_STS, HeaderMap::new())
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn sign_v4_inner(
|
||||
mut req: request::Builder,
|
||||
content_len: i64,
|
||||
@@ -399,6 +401,7 @@ pub fn sign_v4_trailer(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(unused_variables, unused_mut)]
|
||||
mod tests {
|
||||
use http::request;
|
||||
use time::macros::datetime;
|
||||
@@ -429,9 +432,10 @@ mod tests {
|
||||
);
|
||||
headers.insert("x-amz-date", timestamp.parse().unwrap());
|
||||
|
||||
let mut query = <Vec<(String, String)>>::new();
|
||||
query.push(("max-keys".to_string(), "2".to_string()));
|
||||
query.push(("prefix".to_string(), "J".to_string()));
|
||||
let query = vec![
|
||||
("max-keys".to_string(), "2".to_string()),
|
||||
("prefix".to_string(), "J".to_string()),
|
||||
];
|
||||
let uri = req.uri_ref().unwrap().clone();
|
||||
let mut parts = req.uri_ref().unwrap().clone().into_parts();
|
||||
parts.path_and_query = Some(
|
||||
|
||||
Reference in New Issue
Block a user