mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-06 21:03:13 +00:00
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:
+3
-3
@@ -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
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user