chore: clean relative to references and borrows

- lint message: the borrowed expression implements the required traits
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrows_for_generic_args
- lint message: this expression creates a reference which is immediately dereferenced by the compiler
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#needless_borrow
- lint message: you don't need to add `&` to all patterns
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#match_ref_pat
- remove useless taken reference
lint message: needlessly taken reference of left operand
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#op_ref
- use &Path instead of &PathBuf as fn parameters
lint message: writing `&PathBuf` instead of `&Path` involves a new object where a slice will do
help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.92.0/index.html#ptr_arg
This commit is contained in:
Gwen Lg
2025-12-13 17:43:05 +01:00
parent 209263eb93
commit 141b3f24f1
35 changed files with 129 additions and 134 deletions
+6 -6
View File
@@ -124,7 +124,7 @@ fn handle_http_precondition(
) -> Result<Option<Response<ResBody>>, Error> {
let precondition_headers = PreconditionHeaders::parse(req)?;
if let Some(status_code) = precondition_headers.check(&version, &version_meta.etag)? {
if let Some(status_code) = precondition_headers.check(version, &version_meta.etag)? {
Ok(Some(
Response::builder()
.status(status_code)
@@ -189,7 +189,7 @@ pub async fn handle_head_without_ctx(
OekDerivationInfo::for_object(&object, object_version),
)?;
let checksum_mode = checksum_mode(&req);
let checksum_mode = checksum_mode(req);
if let Some(part_number) = part_number {
match version_data {
@@ -316,7 +316,7 @@ pub async fn handle_get_without_ctx(
OekDerivationInfo::for_object(&object, last_v),
)?;
let checksum_mode = checksum_mode(&req);
let checksum_mode = checksum_mode(req);
match (part_number, parse_range_header(req, last_v_meta.size)?) {
(Some(_), Some(_)) => Err(Error::bad_request(
@@ -403,7 +403,7 @@ async fn handle_get_full(
let mut resp_builder = object_headers(
version,
version_meta,
&meta_inner,
meta_inner,
encryption,
checksum_mode,
)
@@ -515,7 +515,7 @@ async fn handle_get_range(
match &version_data {
ObjectVersionData::DeleteMarker => unreachable!(),
ObjectVersionData::Inline(_meta, bytes) => {
let bytes = encryption.decrypt_blob(&bytes)?;
let bytes = encryption.decrypt_blob(bytes)?;
if end as usize <= bytes.len() {
let body = bytes_body(bytes[begin as usize..end as usize].to_vec().into());
Ok(resp_builder.body(body)?)
@@ -564,7 +564,7 @@ async fn handle_get_part(
if part_number != 1 {
return Err(Error::InvalidPart);
}
let bytes = encryption.decrypt_blob(&bytes)?;
let bytes = encryption.decrypt_blob(bytes)?;
assert_eq!(bytes.len() as u64, version_meta.size);
Ok(resp_builder
.header(CONTENT_LENGTH, format!("{}", bytes.len()))