Skip to content

Commit d042f87

Browse files
committed
fixed clippy issues and cleanup of unnecessary imports
1 parent 5080bf9 commit d042f87

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+232
-197
lines changed

Cargo.toml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ readme = "README.md"
1010
keywords = ["object-storage", "minio", "s3"]
1111
categories = ["api-bindings", "web-programming::http-client"]
1212

13-
[dependencies.reqwest]
14-
version = "0.12.22"
15-
default-features = false
16-
features = ["stream"]
17-
1813
[features]
1914
default = ["default-tls", "default-crypto"]
2015
default-tls = ["reqwest/default-tls"]
@@ -23,21 +18,29 @@ rustls-tls = ["reqwest/rustls-tls"]
2318
default-crypto = ["dep:sha2", "dep:hmac"]
2419
ring = ["dep:ring"]
2520

21+
[workspace.dependencies]
22+
uuid = "1.18"
23+
futures-util = "0.3"
24+
reqwest = { version = "0.12", default-features = false }
25+
bytes = "1.10"
26+
async-std = "1.13"
27+
28+
2629
[dependencies]
30+
uuid = { workspace = true, features = ["v4"] }
31+
futures-util = { workspace = true }
32+
bytes = { workspace = true }
33+
async-std = { workspace = true, features = ["attributes"] }
34+
reqwest = { workspace = true, features = ["stream"] }
35+
2736
async-recursion = "1.1.1"
28-
async-std = { version = "1.13.1", features = ["attributes"] }
2937
async-stream = "0.3.6"
3038
async-trait = "0.1.88"
3139
base64 = "0.22.1"
32-
byteorder = "1.5.0"
33-
bytes = "1.10.1"
3440
chrono = "0.4.41"
3541
crc = "3.3.0"
3642
dashmap = "6.1.0"
37-
derivative = "2.2.0"
3843
env_logger = "0.11.8"
39-
futures-util = "0.3.31"
40-
hex = "0.4.3"
4144
hmac = { version = "0.12.1", optional = true }
4245
hyper = { version = "1.6.0", features = ["full"] }
4346
lazy_static = "1.5.0"
@@ -46,26 +49,25 @@ md5 = "0.8.0"
4649
multimap = "0.10.1"
4750
percent-encoding = "2.3.1"
4851
url = "2.5.4"
49-
rand = { version = "0.8.5", features = ["small_rng"] }
5052
regex = "1.11.1"
5153
ring = { version = "0.17.14", optional = true, default-features = false, features = ["alloc"] }
5254
serde = { version = "1.0.219", features = ["derive"] }
53-
serde_json = "1.0.140"
55+
serde_json = "1.0.142"
5456
sha2 = { version = "0.10.9", optional = true }
5557
urlencoding = "2.1.3"
5658
xmltree = "0.11.0"
57-
futures = "0.3.31"
5859
http = "1.3.1"
59-
thiserror = "2.0.12"
60+
thiserror = "2.0.14"
6061

6162
[dev-dependencies]
63+
minio-common = { path = "./common" }
64+
minio-macros = { path = "./macros" }
6265
tokio = { version = "1.47.1", features = ["full"] }
63-
minio_common = { path = "./common" }
6466
async-std = { version = "1.13.1", features = ["attributes", "tokio1"] }
6567
clap = { version = "4.5.44", features = ["derive"] }
68+
rand = { version = "0.9.2", features = ["small_rng"] }
6669
quickcheck = "1.0.3"
6770
criterion = "0.7.0"
68-
minio-macros = { path = "./macros" }
6971

7072
[lib]
7173
name = "minio"

common/Cargo.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
[package]
2-
name = "minio_common"
2+
name = "minio-common"
33
version = "0.1.0"
44
edition = "2024"
55

66
[dependencies]
77
minio = {path = ".." }
8+
uuid = { workspace = true, features = ["v4"] }
9+
reqwest = { workspace = true }
10+
bytes = { workspace = true }
11+
async-std = { workspace = true }
12+
13+
futures-io = "0.3.31"
814
tokio = { version = "1.47.1", features = ["full"] }
9-
async-std = "1.13.1"
10-
rand = { version = "0.8.5", features = ["small_rng"] }
11-
bytes = "1.10.1"
15+
rand = { version = "0.9.2", features = ["small_rng"] }
16+
1217
log = "0.4.27"
1318
chrono = "0.4.41"
14-
reqwest = "0.12.22"
19+
1520
http = "1.3.1"
16-
futures = "0.3.31"
17-
uuid = { version = "1.18.0", features = ["v4"] }
1821

1922
[lib]
2023
name = "minio_common"

common/src/cleanup_guard.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ impl CleanupGuard {
3838
pub async fn cleanup(client: Client, bucket_name: &str) {
3939
tokio::select!(
4040
_ = tokio::time::sleep(std::time::Duration::from_secs(60)) => {
41-
eprintln!("Cleanup timeout after 60s while removing bucket {}", bucket_name);
41+
eprintln!("Cleanup timeout after 60s while removing bucket {bucket_name}");
4242
},
4343
outcome = client.delete_and_purge_bucket(bucket_name) => {
4444
match outcome {
4545
Ok(_) => {
4646
//eprintln!("Bucket {} removed successfully", bucket_name);
4747
}
4848
Err(e) => {
49-
eprintln!("Error removing bucket '{}':\n{}", bucket_name, e);
49+
eprintln!("Error removing bucket '{bucket_name}':\n{e}");
5050
}
5151
}
5252
}

common/src/example.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn create_bucket_replication_config_example(dst_bucket: &str) -> Replication
140140
rules: vec![ReplicationRule {
141141
id: Some(String::from("rule1")),
142142
destination: Destination {
143-
bucket_arn: String::from(&format!("arn:aws:s3:::{}", dst_bucket)),
143+
bucket_arn: String::from(&format!("arn:aws:s3:::{dst_bucket}")),
144144
..Default::default()
145145
},
146146
filter: Some(Filter {
@@ -170,8 +170,8 @@ pub fn create_object_lock_config_example() -> ObjectLockConfig {
170170
pub fn create_post_policy_example(bucket_name: &str, object_name: &str) -> PostPolicy {
171171
let expiration: DateTime<Utc> = utc_now() + chrono::Duration::days(5);
172172

173-
let mut policy = PostPolicy::new(&bucket_name, expiration).unwrap();
174-
policy.add_equals_condition("key", &object_name).unwrap();
173+
let mut policy = PostPolicy::new(bucket_name, expiration).unwrap();
174+
policy.add_equals_condition("key", object_name).unwrap();
175175
policy
176176
.add_content_length_range_condition(1024 * 1024, 4 * 1024 * 1024)
177177
.unwrap();
@@ -189,7 +189,7 @@ pub fn create_select_content_data() -> (String, String) {
189189
(body, data)
190190
}
191191
pub fn create_select_content_request() -> SelectRequest {
192-
let request = SelectRequest::new_csv_input_output(
192+
SelectRequest::new_csv_input_output(
193193
"select * from S3Object",
194194
CsvInputSerialization {
195195
compression_type: None,
@@ -209,6 +209,5 @@ pub fn create_select_content_request() -> SelectRequest {
209209
record_delimiter: None,
210210
},
211211
)
212-
.unwrap();
213-
request
212+
.unwrap()
214213
}

common/src/rand_reader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// See the License for the specific language governing permissions and
1414
// limitations under the License.
1515

16-
use futures::AsyncRead;
16+
use futures_io::AsyncRead;
1717
use std::io;
1818
use std::pin::Pin;
1919
use std::task::{Context, Poll};
@@ -34,7 +34,7 @@ impl io::Read for RandReader {
3434
let bytes_read = buf.len().min(self.size as usize);
3535

3636
if bytes_read > 0 {
37-
let random: &mut dyn rand::RngCore = &mut rand::thread_rng();
37+
let random: &mut dyn rand::RngCore = &mut rand::rng();
3838
random.fill_bytes(&mut buf[0..bytes_read]);
3939
}
4040

@@ -53,7 +53,7 @@ impl AsyncRead for RandReader {
5353
let bytes_read = buf.len().min(self.size as usize);
5454

5555
if bytes_read > 0 {
56-
let random: &mut dyn rand::RngCore = &mut rand::thread_rng();
56+
let random: &mut dyn rand::RngCore = &mut rand::rng();
5757
random.fill_bytes(&mut buf[0..bytes_read]);
5858
}
5959

common/src/rand_src.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
use async_std::stream::Stream;
1717
use bytes::Bytes;
18-
use futures::io::AsyncRead;
18+
use futures_io::AsyncRead;
1919
use rand::prelude::SmallRng;
2020
use rand::{RngCore, SeedableRng};
2121
use std::io;
@@ -30,7 +30,7 @@ pub struct RandSrc {
3030
impl RandSrc {
3131
#[allow(dead_code)]
3232
pub fn new(size: u64) -> RandSrc {
33-
let rng = SmallRng::from_entropy();
33+
let rng: SmallRng = SmallRng::from_os_rng();
3434
RandSrc { size, rng }
3535
}
3636
}

common/src/test_context.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,30 @@ impl TestContext {
8484

8585
let host: String =
8686
std::env::var("SERVER_ENDPOINT").unwrap_or(DEFAULT_SERVER_ENDPOINT.to_string());
87-
log::debug!("SERVER_ENDPOINT={}", host);
87+
log::debug!("SERVER_ENDPOINT={host}");
8888
let access_key: String =
8989
std::env::var("ACCESS_KEY").unwrap_or(DEFAULT_ACCESS_KEY.to_string());
90-
log::debug!("ACCESS_KEY={}", access_key);
90+
log::debug!("ACCESS_KEY={access_key}");
9191
let secret_key: String =
9292
std::env::var("SECRET_KEY").unwrap_or(DEFAULT_SECRET_KEY.to_string());
9393
log::debug!("SECRET_KEY=*****");
9494
let secure: bool = std::env::var("ENABLE_HTTPS")
9595
.unwrap_or(DEFAULT_ENABLE_HTTPS.to_string())
9696
.parse()
9797
.unwrap_or(false);
98-
log::debug!("ENABLE_HTTPS={}", secure);
98+
log::debug!("ENABLE_HTTPS={secure}");
9999
let ssl_cert: String =
100100
std::env::var("MINIO_SSL_CERT_FILE").unwrap_or(DEFAULT_SSL_CERT_FILE.to_string());
101-
log::debug!("MINIO_SSL_CERT_FILE={}", ssl_cert);
101+
log::debug!("MINIO_SSL_CERT_FILE={ssl_cert}");
102102
let ssl_cert_file: PathBuf = ssl_cert.into();
103103
let ignore_cert_check: bool = std::env::var("IGNORE_CERT_CHECK")
104104
.unwrap_or(DEFAULT_IGNORE_CERT_CHECK.to_string())
105105
.parse()
106106
.unwrap_or(true);
107-
log::debug!("IGNORE_CERT_CHECK={}", ignore_cert_check);
107+
log::debug!("IGNORE_CERT_CHECK={ignore_cert_check}");
108108
let region: String =
109109
std::env::var("SERVER_REGION").unwrap_or(DEFAULT_SERVER_REGION.to_string());
110-
log::debug!("SERVER_REGION={:?}", region);
110+
log::debug!("SERVER_REGION={region:?}");
111111

112112
let mut base_url: BaseUrl = host.parse().unwrap();
113113
base_url.https = secure;

common/src/utils.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515

1616
use http::{Response as HttpResponse, StatusCode};
1717
use minio::s3::error::Error;
18-
use rand::distributions::Standard;
19-
use rand::{Rng, thread_rng};
18+
19+
use rand::Rng;
20+
use rand::distr::StandardUniform;
2021
use uuid::Uuid;
2122

2223
pub fn rand_bucket_name() -> String {
@@ -28,9 +29,9 @@ pub fn rand_object_name() -> String {
2829
}
2930

3031
pub fn rand_object_name_utf8(len: usize) -> String {
31-
let rng = thread_rng();
32-
rng.sample_iter::<char, _>(Standard)
33-
.filter(|c| !c.is_control())
32+
let rng = rand::rng();
33+
rng.sample_iter(StandardUniform)
34+
.filter(|c: &char| !c.is_control())
3435
.take(len)
3536
.collect()
3637
}
@@ -39,9 +40,9 @@ pub async fn get_bytes_from_response(v: Result<reqwest::Response, Error>) -> byt
3940
match v {
4041
Ok(r) => match r.bytes().await {
4142
Ok(b) => b,
42-
Err(e) => panic!("{:?}", e),
43+
Err(e) => panic!("{e:?}"),
4344
},
44-
Err(e) => panic!("{:?}", e),
45+
Err(e) => panic!("{e:?}"),
4546
}
4647
}
4748

@@ -52,5 +53,5 @@ pub fn get_response_from_bytes(bytes: bytes::Bytes) -> reqwest::Response {
5253
.body(bytes)
5354
.expect("Failed to build HTTP response");
5455

55-
reqwest::Response::try_from(http_response).expect("Failed to convert to reqwest::Response")
56+
reqwest::Response::from(http_response)
5657
}

examples/append_object.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use minio::s3::response::{AppendObjectResponse, StatObjectResponse};
2222
use minio::s3::segmented_bytes::SegmentedBytes;
2323
use minio::s3::types::S3Api;
2424
use rand::Rng;
25-
use rand::distributions::Alphanumeric;
25+
use rand::distr::Alphanumeric;
2626

2727
#[tokio::main]
2828
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
@@ -78,7 +78,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
7878
}
7979

8080
fn random_string(len: usize) -> String {
81-
rand::thread_rng()
81+
rand::rng()
8282
.sample_iter(&Alphanumeric)
8383
.take(len)
8484
.map(char::from)

macros/Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ name = "minio-macros"
33
version = "0.1.0"
44
edition = "2024"
55

6-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7-
[lib]
8-
proc-macro = true
9-
10-
116
[dependencies]
7+
uuid = { workspace = true, features = ["v4"] }
8+
futures-util = { workspace = true }
9+
1210
syn = "2.0.104"
13-
proc-macro2 = "1.0.95"
11+
proc-macro2 = "1.0.97"
1412
quote = "1.0.40"
1513
darling = "0.21.0"
1614
darling_core = "0.21.0"
17-
uuid = { version = "1.17.0", features = ["v4"] }
1815

1916
[dev-dependencies]
20-
minio_common = { path = "../common" }
17+
minio-common = { path = "../common" }
18+
19+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
20+
[lib]
21+
proc-macro = true

0 commit comments

Comments
 (0)