mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-21 03:46:37 +00:00
fix:Apply suggestions from clippy 1.88
This commit is contained in:
@@ -660,7 +660,7 @@ mod tests {
|
||||
let json = index.to_json().unwrap();
|
||||
let json_str = String::from_utf8(json).unwrap();
|
||||
|
||||
println!("json_str: {}", json_str);
|
||||
println!("json_str: {json_str}");
|
||||
// 验证 JSON 内容
|
||||
|
||||
assert!(json_str.contains("\"compressed\": 100"));
|
||||
|
||||
@@ -191,7 +191,7 @@ mod tests {
|
||||
|
||||
// Extract ETag using our generic system
|
||||
let extracted_etag = resolve_etag_generic(&mut compress_reader);
|
||||
println!("📋 Extracted ETag: {:?}", extracted_etag);
|
||||
println!("📋 Extracted ETag: {extracted_etag:?}");
|
||||
|
||||
assert_eq!(extracted_etag, Some("real_world_etag".to_string()));
|
||||
|
||||
@@ -206,7 +206,7 @@ mod tests {
|
||||
let mut compress_reader2 = CompressReader::new(encrypt_reader2, CompressionAlgorithm::Zstd);
|
||||
|
||||
let trait_etag = resolve_etag_generic(&mut compress_reader2);
|
||||
println!("📋 Trait-based ETag: {:?}", trait_etag);
|
||||
println!("📋 Trait-based ETag: {trait_etag:?}");
|
||||
|
||||
assert_eq!(trait_etag, Some("core_etag".to_string()));
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ mod tests {
|
||||
// 读取超限,应该返回错误
|
||||
let err = match read_full(&mut r, &mut buf).await {
|
||||
Ok(n) => {
|
||||
println!("Read {} bytes", n);
|
||||
println!("Read {n} bytes");
|
||||
assert_eq!(n, 3);
|
||||
assert_eq!(&buf[..n], b"abc");
|
||||
None
|
||||
|
||||
@@ -396,7 +396,7 @@ mod tests {
|
||||
|
||||
let expected = format!("{:x}", hasher.finalize());
|
||||
|
||||
println!("expected: {}", expected);
|
||||
println!("expected: {expected}");
|
||||
|
||||
let reader = Cursor::new(data.clone());
|
||||
let reader = BufReader::new(reader);
|
||||
@@ -485,8 +485,7 @@ mod tests {
|
||||
|
||||
// 验证 etag(注意:压缩会改变数据,所以这里的 etag 验证可能需要调整)
|
||||
println!(
|
||||
"Test completed successfully with compression: {}, encryption: {}",
|
||||
is_compress, is_encrypt
|
||||
"Test completed successfully with compression: {is_compress}, encryption: {is_encrypt}"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -549,7 +548,7 @@ mod tests {
|
||||
];
|
||||
|
||||
for algorithm in algorithms {
|
||||
println!("\nTesting algorithm: {:?}", algorithm);
|
||||
println!("\nTesting algorithm: {algorithm:?}");
|
||||
|
||||
let reader = BufReader::new(Cursor::new(data.clone()));
|
||||
let reader = Box::new(WarpReader::new(reader));
|
||||
@@ -576,7 +575,7 @@ mod tests {
|
||||
// Verify
|
||||
assert_eq!(decompressed_data.len(), data.len());
|
||||
assert_eq!(&decompressed_data, &data);
|
||||
println!(" ✓ Algorithm {:?} test passed", algorithm);
|
||||
println!(" ✓ Algorithm {algorithm:?} test passed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ static HTTP_DEBUG_LOG: bool = false;
|
||||
#[inline(always)]
|
||||
fn http_debug_log(args: std::fmt::Arguments) {
|
||||
if HTTP_DEBUG_LOG {
|
||||
println!("{}", args);
|
||||
println!("{args}");
|
||||
}
|
||||
}
|
||||
macro_rules! http_log {
|
||||
@@ -87,7 +87,7 @@ impl HttpReader {
|
||||
let resp = request
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| Error::other(format!("HttpReader HTTP request error: {}", e)))?;
|
||||
.map_err(|e| Error::other(format!("HttpReader HTTP request error: {e}")))?;
|
||||
|
||||
if resp.status().is_success().not() {
|
||||
return Err(Error::other(format!(
|
||||
@@ -98,7 +98,7 @@ impl HttpReader {
|
||||
|
||||
let stream = resp
|
||||
.bytes_stream()
|
||||
.map_err(|e| Error::other(format!("HttpReader stream error: {}", e)));
|
||||
.map_err(|e| Error::other(format!("HttpReader stream error: {e}")));
|
||||
|
||||
Ok(Self {
|
||||
inner: StreamReader::new(Box::pin(stream)),
|
||||
@@ -250,8 +250,8 @@ impl HttpWriter {
|
||||
}
|
||||
Err(e) => {
|
||||
// http_log!("[HttpWriter::spawn] HTTP request error: {e}");
|
||||
let _ = err_tx.send(Error::other(format!("HTTP request failed: {}", e)));
|
||||
return Err(Error::other(format!("HTTP request failed: {}", e)));
|
||||
let _ = err_tx.send(Error::other(format!("HTTP request failed: {e}")));
|
||||
return Err(Error::other(format!("HTTP request failed: {e}")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ impl AsyncWrite for HttpWriter {
|
||||
|
||||
self.sender
|
||||
.try_send(Some(Bytes::copy_from_slice(buf)))
|
||||
.map_err(|e| Error::other(format!("HttpWriter send error: {}", e)))?;
|
||||
.map_err(|e| Error::other(format!("HttpWriter send error: {e}")))?;
|
||||
|
||||
Poll::Ready(Ok(buf.len()))
|
||||
}
|
||||
@@ -315,7 +315,7 @@ impl AsyncWrite for HttpWriter {
|
||||
// http_log!("[HttpWriter::poll_shutdown] url: {}, method: {:?}", url, method);
|
||||
self.sender
|
||||
.try_send(None)
|
||||
.map_err(|e| Error::other(format!("HttpWriter shutdown error: {}", e)))?;
|
||||
.map_err(|e| Error::other(format!("HttpWriter shutdown error: {e}")))?;
|
||||
// http_log!(
|
||||
// "[HttpWriter::poll_shutdown] sent shutdown signal to HTTP request, url: {}, method: {:?}",
|
||||
// url,
|
||||
@@ -336,7 +336,7 @@ impl AsyncWrite for HttpWriter {
|
||||
}
|
||||
Poll::Ready(Err(e)) => {
|
||||
// http_log!("[HttpWriter::poll_shutdown] HTTP request failed: {e}, url: {}, method: {:?}", url, method);
|
||||
return Poll::Ready(Err(Error::other(format!("HTTP request failed: {}", e))));
|
||||
return Poll::Ready(Err(Error::other(format!("HTTP request failed: {e}"))));
|
||||
}
|
||||
Poll::Pending => {
|
||||
// http_log!("[HttpWriter::poll_shutdown] HTTP request pending, url: {}, method: {:?}", url, method);
|
||||
|
||||
Reference in New Issue
Block a user