s3-storage: adopt universal clippy/lint baseline; warnings to zero
Add the shared pedantic + unreachable_pub baseline. Dropped two redundant
trailing `continue`s in the upload_part retry loops (needless_continue);
S3Client::new keeps its async signature (public API stability) behind a
documented #[allow(clippy::unused_async)].
clippy --all-targets clean, cargo fmt clean, tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2 files changed,
+35 insertions,
-3 deletions
| 13 |
13 |
|
|
| 14 |
14 |
|
[dev-dependencies]
|
| 15 |
15 |
|
tokio = { version = "1", features = ["macros", "rt"] }
|
|
16 |
+ |
|
|
17 |
+ |
[lints.rust]
|
|
18 |
+ |
unused = "warn"
|
|
19 |
+ |
unreachable_pub = "warn"
|
|
20 |
+ |
|
|
21 |
+ |
[lints.clippy]
|
|
22 |
+ |
pedantic = { level = "warn", priority = -1 }
|
|
23 |
+ |
# Allow-list tuned from a measured breakdown across server/multithreaded/pter
|
|
24 |
+ |
# (2026-07-22). These are the high-churn / low-signal pedantic lints; everything
|
|
25 |
+ |
# else in `pedantic` stays a warning. Keep this block identical across repos.
|
|
26 |
+ |
module_name_repetitions = "allow"
|
|
27 |
+ |
# Doc lints — no docs-completeness push underway.
|
|
28 |
+ |
missing_errors_doc = "allow"
|
|
29 |
+ |
missing_panics_doc = "allow"
|
|
30 |
+ |
doc_markdown = "allow"
|
|
31 |
+ |
# Numeric casts — endemic and mostly intentional in size/byte math.
|
|
32 |
+ |
cast_possible_truncation = "allow"
|
|
33 |
+ |
cast_sign_loss = "allow"
|
|
34 |
+ |
cast_precision_loss = "allow"
|
|
35 |
+ |
cast_possible_wrap = "allow"
|
|
36 |
+ |
cast_lossless = "allow"
|
|
37 |
+ |
# Subjective structure/style nags — high churn, low signal.
|
|
38 |
+ |
must_use_candidate = "allow"
|
|
39 |
+ |
too_many_lines = "allow"
|
|
40 |
+ |
struct_excessive_bools = "allow"
|
|
41 |
+ |
similar_names = "allow"
|
|
42 |
+ |
items_after_statements = "allow"
|
|
43 |
+ |
single_match_else = "allow"
|
|
44 |
+ |
# Frequent false-positives in TUI/router-heavy code — added from the buckets breakdown.
|
|
45 |
+ |
match_same_arms = "allow"
|
|
46 |
+ |
unnecessary_wraps = "allow"
|
|
47 |
+ |
type_complexity = "allow"
|
| 179 |
179 |
|
|
| 180 |
180 |
|
impl S3Client {
|
| 181 |
181 |
|
/// Create a new S3 client from configuration.
|
|
182 |
+ |
// Public async constructor: kept async for API stability across callers.
|
|
183 |
+ |
#[allow(clippy::unused_async)]
|
| 182 |
184 |
|
pub async fn new(config: &S3Config) -> Result<Self, String> {
|
| 183 |
185 |
|
let credentials = Credentials::new(
|
| 184 |
186 |
|
&config.access_key,
|
| 196 |
198 |
|
// unaffected. The SDK's default retry policy still applies per attempt.
|
| 197 |
199 |
|
let timeout_config = aws_sdk_s3::config::timeout::TimeoutConfig::builder()
|
| 198 |
200 |
|
.connect_timeout(Duration::from_secs(10))
|
| 199 |
|
- |
.operation_attempt_timeout(Duration::from_secs(60))
|
|
201 |
+ |
.operation_attempt_timeout(Duration::from_mins(1))
|
| 200 |
202 |
|
.build();
|
| 201 |
203 |
|
|
| 202 |
204 |
|
let s3_config = aws_sdk_s3::Config::builder()
|
| 888 |
890 |
|
"S3 upload_part transient failure, retrying"
|
| 889 |
891 |
|
);
|
| 890 |
892 |
|
tokio::time::sleep(std::time::Duration::from_millis(delay_ms)).await;
|
| 891 |
|
- |
continue;
|
| 892 |
893 |
|
}
|
| 893 |
894 |
|
Err(e) => break Err(e),
|
| 894 |
895 |
|
}
|
| 1082 |
1083 |
|
"S3 upload_part_copy transient failure, retrying"
|
| 1083 |
1084 |
|
);
|
| 1084 |
1085 |
|
tokio::time::sleep(Duration::from_millis(delay_ms)).await;
|
| 1085 |
|
- |
continue;
|
| 1086 |
1086 |
|
}
|
| 1087 |
1087 |
|
Err(e) => break Err(e),
|
| 1088 |
1088 |
|
}
|