fix: resolve all Clippy warnings across codebase - Fixed field reassignment warnings in ecstore/src/file_meta.rs by using struct initialization instead of default + field assignment - Fixed overly complex boolean expression in ecstore/src/utils/os/mod.rs by removing meaningless assertion - Replaced manual Default implementation with derive in crates/zip/src/lib.rs - Updated io::Error usage to use io::Error::other() instead of deprecated pattern - Removed useless assertions and clone-on-copy warnings - Fixed unwrap usage by replacing with expect() providing meaningful error messages - Fixed useless vec usage by using array repeat instead - All code now passes comprehensive Clippy check with --all-targets --all-features -- -D warnings

This commit is contained in:
安正超
2025-05-28 11:00:07 +08:00
parent 96d0155bcc
commit a1f4abf6c3
37 changed files with 309 additions and 255 deletions
+1 -1
View File
@@ -120,7 +120,7 @@ impl Operation for PutFile {
let mut body = StreamReader::new(
req.input
.into_stream()
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e)),
.map_err(std::io::Error::other),
);
tokio::io::copy(&mut body, &mut file)
+2 -2
View File
@@ -281,7 +281,7 @@ async fn start_server(server_addr: SocketAddr, tls_path: Option<String>, app: Ro
.handle(handle.clone())
.serve(app.into_make_service())
.await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
.map_err(io::Error::other)?;
info!("HTTPS server running on https://{}", server_addr);
@@ -323,7 +323,7 @@ async fn start_http_server(addr: SocketAddr, app: Router, handle: axum_server::H
.handle(handle)
.serve(app.into_make_service())
.await
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
.map_err(io::Error::other)
}
async fn shutdown_signal() {
+1
View File
@@ -2420,6 +2420,7 @@ impl Node for NodeService {
}
#[cfg(test)]
#[allow(unused_imports)]
mod tests {
use super::*;
use protos::proto_gen::node_service::{
+2
View File
@@ -71,6 +71,7 @@ const MI_B: usize = 1024 * 1024;
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
#[allow(clippy::result_large_err)]
fn check_auth(req: Request<()>) -> Result<Request<()>, Status> {
let token: MetadataValue<_> = "rustfs rpc".parse().unwrap();
@@ -79,6 +80,7 @@ fn check_auth(req: Request<()>) -> Result<Request<()>, Status> {
_ => Err(Status::unauthenticated("No valid auth token")),
}
}
#[instrument]
fn print_server_info() {
let cfg = CONSOLE_CONFIG.get().unwrap();
+3 -3
View File
@@ -119,7 +119,7 @@ impl FS {
let Some(body) = body else { return Err(s3_error!(IncompleteBody)) };
let body = StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))));
let body = StreamReader::new(body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string()))));
// let etag_stream = EtagReader::new(body);
@@ -961,7 +961,7 @@ impl S3 for FS {
};
let body = Box::new(StreamReader::new(
body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))),
body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string()))),
));
let mut reader = PutObjReader::new(body, content_length as usize);
@@ -1077,7 +1077,7 @@ impl S3 for FS {
};
let body = Box::new(StreamReader::new(
body.map(|f| f.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))),
body.map(|f| f.map_err(|e| std::io::Error::other(e.to_string()))),
));
// mc cp step 4