From 76e7bc8c46c40b30f630aba3970445a5c722034a Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Thu, 3 Jul 2025 08:05:56 +0200 Subject: [PATCH] Fix cargo clippy issues --- .drone.yml | 32 ++++++++++++++++++++++++++++---- src/minio.rs | 8 ++++---- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index 85cf22b..3b0c68a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,17 +4,37 @@ type: docker name: default steps: -- name: cargo_check +- name: fetch_dependencies + image: rust + volumes: + - name: rust_registry + path: /usr/local/cargo/registry + commands: + - cargo fetch + +- name: code_quality + image: rust + volumes: + - name: rust_registry + path: /usr/local/cargo/registry + depends_on: + - fetch_dependencies + commands: + - rustup component add clippy + - cargo clippy -- -D warnings + +- name: test image: rust + volumes: + - name: rust_registry + path: /usr/local/cargo/registry commands: - wget -O /usr/bin/minio https://dl.min.io/server/minio/release/linux-amd64/minio - wget -O /usr/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc - chmod +x /usr/bin/minio /usr/bin/mc - - rustup component add clippy - - cargo clippy -- -D warnings - cargo test -- name: doc +- name: build_doc image: python environment: AWS_ACCESS_KEY_ID: @@ -39,3 +59,7 @@ steps: - aws configure set default.s3.signature_version s3v4 # Upload to bucket - cd public && aws --endpoint-url https://s3.communiquons.org s3 sync . s3://miniok8sbucketsoperator-website + +volumes: + - name: rust_registry + temp: {} \ No newline at end of file diff --git a/src/minio.rs b/src/minio.rs index 682f153..431701e 100644 --- a/src/minio.rs +++ b/src/minio.rs @@ -164,7 +164,7 @@ impl MinioService { /// Get bucket name prefixed by mc alias name fn absolute_bucket_name(&self, name: &str) -> String { - format!("{}/{name}", MC_ALIAS_NAME) + format!("{MC_ALIAS_NAME}/{name}") } /// Execute a minio mc command @@ -172,7 +172,7 @@ impl MinioService { where A: DeserializeOwned, { - log::debug!("exec_mc_cmd with args {:?}", args); + log::debug!("exec_mc_cmd with args {args:?}"); let conf_dir = temp::create_temp_dir()?; let global_flags = ["--config-dir", conf_dir.to_str().unwrap(), "--json"]; @@ -354,7 +354,7 @@ impl MinioService { let bucket_name = self.absolute_bucket_name(bucket); let res = if let Some(quota) = "a { - let quota = format!("{}B", quota); + let quota = format!("{quota}B"); self.exec_mc_cmd::(&[ "quota", "set", @@ -447,7 +447,7 @@ impl MinioService { "governance" => RetentionType::Governance, "compliance" => RetentionType::Compliance, o => { - log::error!("Unknown retention type: {}", o); + log::error!("Unknown retention type: {o}"); return Ok(None); } },