refactor: clean perf related

- use array instead of vec when it's useless
clippy lint message: useless use of `vec!` help: you can use an array directly.
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#useless_vec
- call as_bytes before slicing
lint message: calling `as_bytes` after slicing a string
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#sliced_string_as_bytes

Signed-off-by: Gwen Lg <me@gwenlg.fr>
This commit is contained in:
Gwen Lg
2025-12-13 20:31:05 +01:00
parent 141b3f24f1
commit ea9597819c
5 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -598,7 +598,7 @@ impl ListObjectsQuery {
Some("[") => Ok(RangeBegin::IncludingKey {
key: String::from_utf8(
BASE64_STANDARD
.decode(token[1..].as_bytes())
.decode(&token.as_bytes()[1..])
.ok_or_bad_request("Invalid continuation token")?,
)?,
fallback_key: None,
@@ -606,7 +606,7 @@ impl ListObjectsQuery {
Some("]") => Ok(RangeBegin::AfterKey {
key: String::from_utf8(
BASE64_STANDARD
.decode(token[1..].as_bytes())
.decode(&token.as_bytes()[1..])
.ok_or_bad_request("Invalid continuation token")?,
)?,
}),
@@ -1043,7 +1043,7 @@ mod tests {
#[test]
fn test_extract_upload() {
let objs = vec![
let objs = [
Object::new(
bucket(),
"b".to_string(),
+1 -1
View File
@@ -668,7 +668,7 @@ pub(crate) fn extract_metadata_headers(
let mut ret = Vec::new();
// Preserve standard headers
let standard_header = vec![
let standard_header = [
hyper::header::CONTENT_TYPE,
hyper::header::CACHE_CONTROL,
hyper::header::CONTENT_DISPOSITION,